Skip to content

Commit

Permalink
fix: cache user by id when user is not exist (#4420)
Browse files Browse the repository at this point in the history
Co-authored-by: Ihar <[email protected]>
  • Loading branch information
ihar-tsykala and Ihar authored Nov 28, 2024
1 parent 4f9117f commit a02dacd
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 a02dacd

Please sign in to comment.