DEV Community

Discussion on: How to make nuxt auth working with JWT - a definitive guide

Collapse
 
adashi12 profile image
André Lehner

For anybody wondering where the " self. " comes from in the login component (and getting error messages about it not being defined), above the post request there should be:

const self = this

Basically it is used to access " this " inside the promise.
(not sure how clean this is, though)

Collapse
 
mrnaif2018 profile image
MrNaif2018

Yes, exactly. It was mentioned a line above in my full code, missed it (:
Anyone who visits the full repo can see the full code (:
Thank you for noticing this! I updated the gist and the post to use this instead, as(if I understand it correctly), when using arrow functions for .then callback this is not lost.