Created
January 7, 2016 22:41
-
-
Save kirkbushell/6b60a44c0949d08feb46 to your computer and use it in GitHub Desktop.
Handling JWT, Vue JS and token refreshes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Unauthorised from './Unauthorised' | |
export default function() { | |
return { | |
response: function(response) { | |
switch (response.status) { | |
case 401: return Unauthorised.handle(); | |
} | |
return response; | |
} | |
} | |
}; |
What if i have more no.of components? Let's say i have 100 components, in this case, we can't write watchers in all the components right? So what would be the best solution for it, to pass the data to the previous call?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@kirkbushell
I solved it using vuex and a watcher on the component.
In my component