/** * Store for apps * * @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 * */ import AppsDatabase from './../database/apps.js' import observable from '@riotjs/observable' export default observable({ 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) }) } })