0

At some point between editing my code I had at least a portion of this working but of course did not commit before those times.

project: https://github.com/Ampix0/ticker-for-robinhood;

Code issue: https://github.com/Ampix0/ticker-for-robinhood/blob/master/app/src/renderer/components/LoginPageView.vue

On line 26 you can see the login function, when it completes it is supposed to route to the next page, passing along the access token.

Error

TypeError: Cannot read property '$router' of undefined
    at eval (eval at <anonymous> (renderer.js:1574), <anonymous>:18:21)
1
  • 1
    You lost your this context. There's dozens of answers to how to fix this here. Commented Apr 26, 2017 at 2:57

1 Answer 1

0

Basically is the same problem which I just answered a few days ago: Show error message in Vue js

Because you lost the this reference in .then(function (response) {..

Use arrow functions can solve this easily:

.then((response) => {
    this.$router.push({
        name: 'home-page',
        params: {
            authKey: response.data.token
        }
    })
})
Sign up to request clarification or add additional context in comments.

1 Comment

I thought it would be something like this. Thank you!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.