Reseting Vuex module to its original state could be tideous if you have to manually reset all values. So instead you could use a function to retrieve the default state.
const getDefaultState = () => {
return {
id: '',
authors: []
}
}
const state = getDefaultState()
const mutations = {
resetEditor(state) {
Object.assign(state, getDefaultState())
}
}
const actions = {
resetEditor({ commit }) {
commit('resetEditor')
}
}
export default {
state,
mutations,
actions
}