const state = { newPlatform: sessionStorage.getItem('newPlatform') || 0 } const mutations = { setNewPlatform: (state, newPlatform) => { sessionStorage.setItem('newPlatform', newPlatform) state.newPlatform = Number(newPlatform) } } const actions = { setNewPlatform({ commit }, device) { commit('setNewPlatform', device) } } export default { namespaced: true, state, mutations, actions }