-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5543 from guardian/gh-lp-query-params-newspaper
Changes to Keep query parameters in URL when signing out for Newspaper
- Loading branch information
Showing
3 changed files
with
22 additions
and
0 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
support-frontend/assets/helpers/signoutRedirectStorage/signoutRedirectStorage.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import * as storage from 'helpers/storage/storage'; | ||
|
||
const REDIRECT_AFTER_SIGNOUT_STORAGE_KEY = 'redirectAfterSignOut'; | ||
|
||
export const setSignOutRedirectInStorage = (): void => { | ||
storage.setSession(REDIRECT_AFTER_SIGNOUT_STORAGE_KEY, window.location.href); | ||
}; | ||
|
||
export const checkSignOutRedirectInStorage = (): void => { | ||
const redirectUrlFromSessionStorage = storage.getSession( | ||
REDIRECT_AFTER_SIGNOUT_STORAGE_KEY, | ||
); | ||
//This check is to make sure we are retaining the url with query params when we hit sign out | ||
if (redirectUrlFromSessionStorage) { | ||
storage.setSession(REDIRECT_AFTER_SIGNOUT_STORAGE_KEY, ''); | ||
window.location.href = redirectUrlFromSessionStorage; | ||
} | ||
}; |
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