-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Raphael Kabo
committed
Dec 11, 2023
1 parent
83c815f
commit 0ac75f9
Showing
4 changed files
with
32 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,17 @@ | ||
import type { Response } from 'express'; | ||
|
||
//could this be unified with IdentityDetails in globalstate.ts ? | ||
interface IdentityLocalState { | ||
userId?: string; | ||
email?: string; | ||
name?: string; | ||
signInStatus?: string; | ||
} | ||
import type { IdentityDetails } from '@/shared/globals'; | ||
|
||
export const setIdentityLocalState = ( | ||
res: Response, | ||
identityLocalState: IdentityLocalState, | ||
): void => { | ||
identityLocalState: IdentityDetails, | ||
) => { | ||
res.locals.identity = identityLocalState; | ||
}; | ||
export const getIdentityLocalState = ( | ||
res: Response, | ||
): IdentityLocalState | undefined => { | ||
return res.locals.identity; | ||
): IdentityDetails | undefined => { | ||
return res.locals?.identity; | ||
}; | ||
export const clearIdentityLocalState = (res: Response): void => { | ||
export const clearIdentityLocalState = (res: Response) => { | ||
delete res.locals.identity; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters