Skip to content

Commit

Permalink
fix: cache user by id when user is not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
Ihar committed Nov 28, 2024
1 parent 1887105 commit d5b131b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion api-gateway/src/helpers/interceptors/utils/hash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ import crypto from 'crypto';
import {IAuthUser} from '@guardian/common';

export function getHash(user: IAuthUser | null): string {
return crypto.createHash('md5').update(JSON.stringify(user.id ?? 'anonymous')).digest('hex');
return crypto.createHash('md5').update(JSON.stringify(user?.id ?? 'anonymous')).digest('hex');
}

0 comments on commit d5b131b

Please sign in to comment.