I use vue.js with nuxt and want to remove something from the vuex store upon leaving the site.
I tried
beforeDestroy ({ store }) {
store.commit('auth/setUserShowSecureAccountHint', false)
}
which didn't work as store is not known
and also
beforeDestroy () {
this.store.commit('auth/setUserShowSecureAccountHint', false)
}
didn't work as store
is not known.
How can I access the vuex store upon leaving the site?
You should prefix the store
keyword by $
sign as follows :
beforeDestroy () {
this.$store.commit('auth/setUserShowSecureAccountHint', false)
}