You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
715 B
37 lines
715 B
import createPersistedState from 'vuex-persistedstate'
|
|
// import localforage from 'localforage'
|
|
|
|
// export const plugins = [ createPersistedState({
|
|
// key:'fuckme',
|
|
// storage:localforage,
|
|
// paths: ['user.token'] //,'room.room'
|
|
// }) ]
|
|
|
|
export const state = () => ({
|
|
user: {}
|
|
})
|
|
|
|
export const getters = {
|
|
user(state){
|
|
return state.user;
|
|
}
|
|
}
|
|
|
|
export const mutations = {
|
|
SET_USER (state,user) {
|
|
state.user=user;
|
|
}
|
|
}
|
|
|
|
export const actions = {
|
|
nuxtServerInit({ commit }, { req, res }) {
|
|
if (req.session && req.session.user) {
|
|
const { username, password } = req.session.user
|
|
const user = {
|
|
username,
|
|
password
|
|
}
|
|
commit('SET_USER', user)
|
|
}
|
|
},
|
|
}
|
|
|