-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Intercept all http responses and store expiration time from headers in local storage. Drive expiration timers in app container across all tabs with browser storage events and accompanying react hooks integration. Show a warning with logout countdown and continue button when session is nearly expired.
- Loading branch information
1 parent
24e9484
commit 87daac4
Showing
5 changed files
with
139 additions
and
3 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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Application Architecture | ||
|
||
## Local Storage Integration | ||
The `useStorage` hook integrates with the browser's localStorage api. | ||
It accepts a localStorage key as its only argument and returns a state | ||
variable and setter function for that state variable. The hook enables | ||
bidirectional data transfer between tabs via an event listener that | ||
is registered with the Web Storage api. | ||
|
||
|
||
 | ||
|
||
The `useStorage` hook currently lives in the `AppContainer` component. It | ||
can be relocated to a more general location should and if the need | ||
ever arise | ||
|
||
## Session Expiration | ||
Session timeout state is communicated to the client in the HTTP(S) | ||
response headers. Every HTTP(S) response is intercepted to read the | ||
session expiration time before being passed into the rest of the | ||
application. A timeout date is computed from the intercepted HTTP(S) | ||
headers and is pushed into local storage, where it can be read using | ||
standard Web Storage apis or other utilities, such as `useStorage`. | ||
|
||
|
||
 | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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