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 4f9117f commit e13d6d4
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 e13d6d4

Please sign in to comment.