Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

boyjarv's avatar

TypeError: Cannot read properties of undefined (reading 'dispatch')

in my actions.js I think this line is failing:

this.$store.dispatch("auth/" + USER_ACTION, response.data.user);

I did originally write it like this:

this.$store.dispatch(`auth/${USER_ACTION}`, response.data.user);
0 likes
5 replies
tykus's avatar

@boyjarv good for you... unfortunately I don't have a crystal ball. The error message says this.$store is undefined... maybe showing the context where this code is used might help?

boyjarv's avatar

got it working now thanks

context.dispatch(USER_ACTION, response.data.user);

Please or to participate in this conversation.