You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
potato-launcher/src/js/stores/apps.js

47 lines
1014 B

2 years ago
/**
* Store for apps
2 years ago
*
* @author Björn Hase
* @license hhttps://www.gnu.org/licenses/gpl-3.0.en.html GPL-3
* @link https://gitea.node001.net/HerrHase/potato-launcher.git
2 years ago
*
*/
2 years ago
import AppsDatabase from './../database/apps.js'
import observable from '@riotjs/observable'
2 years ago
2 years ago
export default observable({
2 years ago
2 years ago
get() {
const appsDatabase = new AppsDatabase()
appsDatabase.find().then((data) => {
this.trigger('ready', data)
})
},
getOne(id) {
const appsDatabase = new AppsDatabase()
appsDatabase.findOneById(id).then((data) => {
this.trigger('readyOne', data)
})
},
post(data) {
const appsDatabase = new AppsDatabase()
appsDatabase.create(data).then((data) => {
this.trigger('success', data)
})
},
put(data) {
const appsDatabase = new AppsDatabase()
appsDatabase.update(data).then((data) => {
this.trigger('success', data)
})
}
})