0π
β
So I found out that the problem was caused by the fact that I tried to acces this.$store.state.x
while it should be this.$store.state.stock.x
. Is there a way to not need the module name to access the state?
0π
The above scenerio is happening because javascript is asyncronous and hence before the response from your api call is returned the console statement is executed and hence you see that as undefined.
You can try using async await on axios call as
async actionName ()
{
await axios.get(..).then(response => { console.log(response)} )
}
Source:stackexchange.com