Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

18115 get keycload token from rootState #742

Merged
merged 3 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "name-request",
"version": "5.3.3",
"version": "5.3.4",
"private": true,
"appName": "Name Request UI",
"sbcName": "SBC Common Components",
Expand Down
1 change: 1 addition & 0 deletions src/interfaces/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export * from './models'
export * from './name-check-interfaces'
export * from './dialog-options'
export * from './refund-params-interface'
export * from './root-state-interface'

// external interfaces
export type {
Expand Down
8 changes: 8 additions & 0 deletions src/interfaces/root-state-interface.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/** The ROOT state model interface. */
export interface RootStateIF {
auth: {
token: string,
idToken: string,
refreshToken: string
}
}
5 changes: 3 additions & 2 deletions src/store/getters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
RequestNameI,
RequestOrConsentIF,
ReservedReqI,
RootStateIF,
SelectOptionsI,
StaffPaymentIF,
StateIF,
Expand Down Expand Up @@ -67,8 +68,8 @@ export const isMobile = (state: StateIF): boolean => {
}

/** True if user is authenticated, else False. */
export const isAuthenticated = (): boolean => {
return Boolean(sessionStorage.getItem(SessionStorageKeys.KeyCloakToken))
export const isAuthenticated = (rootState: RootStateIF): boolean => {
return Boolean(rootState.auth?.token)
severinbeauvais marked this conversation as resolved.
Show resolved Hide resolved
}

export const getCurrentJsDate = (state: StateIF): Date => {
Expand Down
Loading