chore: optimize the code of workplace; 🌟
This commit is contained in:
@@ -2,12 +2,21 @@ import Vue from 'vue'
|
||||
import Vuex from 'vuex'
|
||||
import account from './modules/account'
|
||||
import setting from './modules/setting'
|
||||
import PouchDB from 'pouchdb'
|
||||
|
||||
const db = new PouchDB('adminDb')
|
||||
|
||||
Vue.use(Vuex)
|
||||
|
||||
export default new Vuex.Store({
|
||||
const store = new Vuex.Store({
|
||||
modules: {
|
||||
account,
|
||||
setting
|
||||
}
|
||||
})
|
||||
// 读取用户信息
|
||||
db.get('currUser')
|
||||
.then(doc => store.commit('account/setUser', doc.user))
|
||||
.catch(() => {})
|
||||
|
||||
export default store
|
||||
|
||||
@@ -5,7 +5,12 @@ let db = new PouchDB('adminDb')
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
user: {}
|
||||
user: {
|
||||
name: '',
|
||||
avatar: '',
|
||||
position: '',
|
||||
address: ''
|
||||
}
|
||||
},
|
||||
mutations: {
|
||||
setUser (state, user) {
|
||||
|
||||
Reference in New Issue
Block a user