In server side I have those code to login:
return jsonify({'email': email, 'token': create_token(email, isAdmin, password)})
In client side I need code to check login and isAdmin.
isLogged() {
if (localStorage.getItem('currentUser') &&
JSON.parse(localStorage.getItem('currentUser')).email) {
return true;
}
return false;
}
isAdmin(){
//???
}
How can I get user role from token?