Hi again Stefan,
With the code you have written, the user logges out when refreshing the page, howto handle so the user don't logges out on page refresh?
The attached screendump is what I have after page refresh
dev-to-uploads.s3.amazonaws.com/i/...
On page reload, check for the token in cookies, and if there is a token in the cookies, just set it in axios
I did:
In authIt.js
const access_token = cookies.get('x-access-token'); if no token redirect to /login
else store.$axios.$get(process.env.LARAVEL_ENDPOINT+'/api/user') .then(resp => { store.$auth.setUser(resp) ......
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hi again Stefan,
With the code you have written, the user logges out when refreshing the page, howto handle so the user don't logges out on page refresh?
The attached screendump is what I have after page refresh
dev-to-uploads.s3.amazonaws.com/i/...
On page reload, check for the token in cookies, and if there is a token in the cookies, just set it in axios
I did:
In authIt.js
const access_token = cookies.get('x-access-token');
if
no token redirect to /login
else
store.$axios.$get(process.env.LARAVEL_ENDPOINT+'/api/user')
.then(resp => {
store.$auth.setUser(resp)
......