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.
46 lines
941 B
46 lines
941 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 = () => ({
|
|
theme:"light"
|
|
})
|
|
|
|
export const getters = {
|
|
theme(state){
|
|
return state.theme
|
|
}
|
|
}
|
|
|
|
export const mutations = {
|
|
SET_THEME (state,theme) {
|
|
if (theme) {
|
|
state.theme=theme;
|
|
}else if (state.theme=='light'){
|
|
state.theme='dark';
|
|
}else{
|
|
state.theme='light';
|
|
}
|
|
}
|
|
}
|
|
|
|
export const actions = {
|
|
changeTheme({commit},theme){
|
|
commit('SET_THEME',theme)
|
|
},
|
|
nuxtServerInit({ commit }, { req, res }) {
|
|
// if (req.session && req.session.user) {
|
|
// const { username, password } = req.session.user
|
|
// const user = {
|
|
// username,
|
|
// password
|
|
// }
|
|
// commit('SET_USER', user)
|
|
// }
|
|
},
|
|
}
|
|
|