-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: updated authentication pending status (#178)
- Loading branch information
Fran McDade
authored and
Fran McDade
committed
Jan 5, 2025
1 parent
50da406
commit f02edff
Showing
18 changed files
with
108 additions
and
89 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
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
5 changes: 3 additions & 2 deletions
5
...s/Content/components/Actions/components/Authentication/components/Button/button.styles.ts
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
2 changes: 1 addition & 1 deletion
2
src/components/common/Banner/components/SessionTimeout/sessionTimeout.tsx
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { useIdleTimer } from "react-idle-timer"; | ||
import { IIdleTimerProps } from "react-idle-timer/dist/types/IIdleTimerProps"; | ||
|
||
/** | ||
* Sets a session timeout that triggers when the user has been idle for the specified duration. | ||
* @param idleTimerProps - The parameters for the session timeout. | ||
*/ | ||
export const useSessionIdleTimer = (idleTimerProps: IIdleTimerProps): void => { | ||
useIdleTimer(idleTimerProps); | ||
}; |
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,10 +1,40 @@ | ||
import { useIdleTimer } from "react-idle-timer"; | ||
import { IIdleTimerProps } from "react-idle-timer/dist/types/IIdleTimerProps"; | ||
import Router from "next/router"; | ||
import { useCallback, useEffect, useState } from "react"; | ||
import { useConfig } from "../../useConfig"; | ||
import { useLocation } from "../../useLocation"; | ||
|
||
export const INACTIVITY_PARAM = "inactivityTimeout"; | ||
|
||
interface UseSessionTimeout { | ||
clearSessionTimeout: () => void; | ||
isSessionTimeout: boolean; | ||
} | ||
|
||
/** | ||
* Sets a session timeout that triggers when the user has been idle for the specified duration. | ||
* @param idleTimerProps - The parameters for the session timeout. | ||
* Session timeout hook. | ||
* @returns flag indicating if the session has timed out. | ||
*/ | ||
export const useSessionTimeout = (idleTimerProps: IIdleTimerProps): void => { | ||
useIdleTimer(idleTimerProps); | ||
export const useSessionTimeout = (): UseSessionTimeout => { | ||
const { | ||
config: { redirectRootToPath }, | ||
} = useConfig(); | ||
const [isSessionTimeout, setIsSessionTimeout] = useState<boolean>(false); | ||
// Get the session timeout from URL parameters. | ||
const { search } = useLocation() || {}; | ||
const sessionTimeout = search?.get(INACTIVITY_PARAM); | ||
|
||
// Clears session timeout state. | ||
const clearSessionTimeout = useCallback((): void => { | ||
setIsSessionTimeout(false); | ||
Router.replace(redirectRootToPath); | ||
}, [redirectRootToPath]); | ||
|
||
useEffect(() => { | ||
setIsSessionTimeout(sessionTimeout === "true"); | ||
}, [sessionTimeout]); | ||
|
||
return { | ||
clearSessionTimeout, | ||
isSessionTimeout, | ||
}; | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { useRouter } from "next/router"; | ||
import { useMemo } from "react"; | ||
import { useConfig } from "./useConfig"; | ||
|
||
export function useRouteRoot(): string { | ||
const { | ||
config: { redirectRootToPath: path }, | ||
} = useConfig(); | ||
const { basePath } = useRouter(); | ||
return useMemo(() => `${basePath}${path}`, [basePath, path]); | ||
} |
This file was deleted.
Oops, something went wrong.
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