Question:
I am trying to access to currents errors store data from Vue but i have not the expected result
The info that i want is allowed in a proxy target object
Answer:
Without more detail I can only guess.My guess is that it’s just a matter of timing. What’s likely happening is that where you are trying to get the contents of
store.state.auth.errors
, the value is still null. But when you log store.state.auth
it returns a Proxy which stays up to date in the dev tools. So when you expand the content of the Proxy, it has already been set.How to validate
If you capture the current value
console.log(JSON.stringify(store.state.auth,null,2))
you can see value logged at the time when the console log is called.How to deal with it
This will depend on what exactly is going on with the rest of your code. If you are relying on an API call, use the
then
/catch
to deal with it. you can also use a watch
or computed
to track the changes if you want to map it to a method call or an error message.If you have better answer, please add a comment about this, thank you!