some dashboard refactor (#2101)

This commit is contained in:
hubery
2020-12-03 20:20:48 +08:00
committed by GitHub
Unverified
parent 0ab055e946
commit 1e846df870
33 changed files with 10494 additions and 10531 deletions
+24
View File
@@ -0,0 +1,24 @@
import Vue from 'vue'
import Vuex from 'vuex'
import fetch from '@/utils/fetch'
Vue.use(Vuex)
const store = new Vuex.Store({
state: {
serverInfo: null
},
mutations: {
SET_SERVER_INFO(state, serverInfo) {
state.serverInfo = serverInfo
}
},
actions: {
async fetchServerInfo({ commit }) {
const json = await fetch('serverinfo')
commit('SET_SERVER_INFO', json || null)
return json
}
}
})
export default store