ProjectManagement_frontend/src/store/index.js

24 lines
443 B
JavaScript
Raw Normal View History

2022-06-27 10:05:27 +08:00
import { createStore } from 'vuex'
2022-07-01 11:35:19 +08:00
import createPersistedState from "vuex-persistedstate"
2022-06-27 10:05:27 +08:00
const store = createStore({
state () {
return {
2022-07-01 11:35:19 +08:00
staff: null
2022-06-27 10:05:27 +08:00
}
},
mutations: {
2022-07-01 11:35:19 +08:00
setStaff(state, staff) {
state.staff = staff
2022-06-27 10:05:27 +08:00
},
2022-07-01 21:18:46 +08:00
updateToken(state, Token) {
state.staff.Token = Token
},
2022-07-01 11:35:19 +08:00
clearStaff(state) {
state.staff = null
2022-06-27 10:05:27 +08:00
},
2022-07-01 11:35:19 +08:00
},
plugins: [createPersistedState()]
2022-06-27 10:05:27 +08:00
})
export default store