UI: Fixed auth service function updatedAuthUserFromToken when authUser and tokenData in null

This commit is contained in:
Vladyslav_Prykhodko 2023-09-06 16:15:33 +03:00
parent f830dd0ae2
commit f3edcc489d

View File

@ -502,7 +502,7 @@ export class AuthService {
private updatedAuthUserFromToken(token: string) { private updatedAuthUserFromToken(token: string) {
const authUser = getCurrentAuthUser(this.store); const authUser = getCurrentAuthUser(this.store);
const tokenData = this.jwtHelper.decodeToken(token); const tokenData = this.jwtHelper.decodeToken(token);
if (['sub', 'firstName', 'lastName'].some(value => authUser[value] !== tokenData[value])) { if (authUser && tokenData && ['sub', 'firstName', 'lastName'].some(value => authUser[value] !== tokenData[value])) {
this.store.dispatch(new ActionAuthUpdateAuthUser({ this.store.dispatch(new ActionAuthUpdateAuthUser({
sub: tokenData.sub, sub: tokenData.sub,
firstName: tokenData.firstName, firstName: tokenData.firstName,