Skip to content

Commit c44417c

Browse files
committed
feat: send data when logout warning appears (60 sec before)
fix: prevent having a dirty state when logout
1 parent 50acba3 commit c44417c

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/components/layout/AutoLogoutCountdown.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
1+
import { useEffect } from 'react'
2+
13
import { declareComponentKeys } from 'i18nifty'
24

5+
import { executePreLogoutActions } from '@/hooks/prelogout'
36
import { useTranslation } from '@/i18n'
47
import { useOidc } from '@/oidc'
58

69
export function AutoLogoutCountdown() {
710
const { t } = useTranslation({ AutoLogoutCountdown })
811
const { autoLogoutState } = useOidc()
912

13+
useEffect(() => {
14+
if (autoLogoutState.shouldDisplayWarning) {
15+
;(async () => {
16+
await executePreLogoutActions()
17+
})()
18+
}
19+
}, [autoLogoutState.shouldDisplayWarning])
20+
1021
if (!autoLogoutState.shouldDisplayWarning) {
1122
return null
1223
}

src/oidc.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ bootstrapOidc(
3131
autoLogoutParams: autoLogoutParams,
3232
// Enable for detailed initialization and token lifecycle logs.
3333
debugLogs: true,
34+
warnUserSecondsBeforeAutoLogout: 60,
3435
}
3536
: {
3637
// Mock mode: no requests to an auth server are made.

0 commit comments

Comments
 (0)