We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
https://github.com/Remchi/reddice/blob/master/client/index.js#L24
jwtDecode can throw an error if a not valid token is passed, how do you suggest handling this?
for now I've created utils/decodeToken.js with:
utils/decodeToken.js
import jwtDecode from 'jwt-decode'; export default function decodeToken(token) { let decoded = {}; try { decoded = jwtDecode(token); } catch (err) { } return decoded; };
and in index.js just call it instead of jwtDecode
index.js
import decodeToken from './utils/decodeToken'; ... store.dispatch(setCurrentUser(decodeToken(localStorage.jwtToken)));
The text was updated successfully, but these errors were encountered:
However I think if it fails, something has to happen, like a redirect or clean up of the invalid token ?
Sorry, something went wrong.
No branches or pull requests
https://github.com/Remchi/reddice/blob/master/client/index.js#L24
jwtDecode can throw an error if a not valid token is passed, how do you suggest handling this?
for now I've created
utils/decodeToken.js
with:and in
index.js
just call it instead of jwtDecodeThe text was updated successfully, but these errors were encountered: