Within my Plugin, I am faced with the following code snippet:
import firebase from 'firebase'
export default context => {
firebase.auth().onAuthStateChanged(userObject => {
// eslint-disable-next-line no-console
console.log({ userObject })
context.store.commit('auth/setUser', { userObject })
})
}
All seems well here as the userObject
is accurately represented.
Now, moving on to the store:
import Vue from 'vue'
export const state = () => ({
user: null
})
export const mutations = {
setUser(state, val) {
// eslint-disable-next-line no-console
console.log(val)
Vue.set(state, 'user', val)
}
}
Things start getting strange when this particular function triggers; my console becomes flooded with messages saying
Do not mutate vuex store state outside mutation handlers
. However, I am unable to pinpoint where exactly this improper mutation may be occurring. After hours of scouring through the code and attempting various adjustments unsuccessfully, I am reaching out for help in resolving this perplexing error. Thank you in advance.