Is it possible to reset all values within my state back to default when a trigger in mutations is activated? This would mean that none of the state values will have any data filled in them.
Typically, I populate my variables with values from my Vue components. However, when reset_data is called, I want everything to go back to its default setting.
How can I make this happen using VueX? Thank you for your help!
STORE.TS:
export default createStore({
state: {
test1: "",
test2: "",
test3: "",
test4: "",
test5: "",
},
mutations: {
reset_state(state) {
//This function gets triggered by a component in my VueJS project
//I need to reset the state here
}
}
})
Note: I am not looking for a solution where I individually declare every variable (test1, test2, ...) for resetting purposes.