I have an array in store/localStorage to save a user's id and work time. However the array.push function is not working.
export const state = () => ({
Total: []
})
export const mutations = {
setTotal(state, value){
state.Total.push(value);
}
}
I have this in my created:
this.$store.commit("localStorage/setTotal", {id: this.signedInUserID, time: 0});
This is the error I got:
TypeError: state.Total.push is not a function
"localStorage/"prefix implies you have a namespaced Vuex module. Did you set that up properly?