AppReports/src/store/index.js
2020-07-30 18:39:37 +02:00

29 lines
625 B
JavaScript

/*
* Copyright (C) Sapphirecode - All Rights Reserved
* This file is part of appreports which is released under GPL-3.0-or-later.
* See file 'LICENSE' for full license details.
* Created by Timo Hocker <timo@scode.ovh>, July 2020
*/
import Vue from 'vue';
import Vuex from 'vuex';
Vue.use (Vuex);
export default new Vuex.Store ({
state: { log: [] },
mutations: {
set_log (state, log) {
state.log = log;
}
},
actions: {
async get_log ({ commit }) {
const log = await fetch ('/log')
.then ((res) => res.json ());
commit ('set_log', log);
}
},
modules: {}
});