[Vuejs]-Promises, argument in .then() is undefined, how to pass?

0👍

actions is outside of the function scope. you need to bind manually or use ES6 arrow functions to avoid undefined.

0👍

Ok this is me overthinking the problem.

In Vue, when passing this to an external function, Vue doesn’t treat it as {state, actions} like React.

The argument (which in my case is this) should be used in the same way as it is used inside the component itself. Calling methods by this.myMethod()

I changed the argument from {state, actions} -> actions at it all worked.

Thanks for the pointers!

Leave a comment