0👍
✅
You should do it after mounted
phase, something like this:
data() {
return {
notifs: null
}
},
mounted() {
service ... .then(({ data }) => { this.notifs = data })
}
But if you want to update data inside this .js
file, you can use store
.
After response resolved you can mutate a state, something like this, depending on your code:
store.commit('updateNotifs', notifs)
Source:stackexchange.com