some dashboard refactor (#2101)
This commit is contained in:
committed by
GitHub
Unverified
parent
0ab055e946
commit
1e846df870
@@ -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
|
||||
Reference in New Issue
Block a user