import {getCache,setCache} from '@/utils/sessionStorage' const state ={ opened:getCache('SIDEBAR_OPENED')?JSON.parse(getCache('SIDEBAR_OPENED')):false } const mutations={ TOGGLE_SIDEBAR:state=>{ state.opened =!state.opened setCache('SIDEBAR_OPENED',state.opened) } } const actions={ togglesidebar({ commit }) { commit('TOGGLE_SIDEBAR') } } export default{ namespaced: true, state, mutations, actions }