fix: Restore individual tabs to correct page post-login, closes #7467

This commit is contained in:
Tom Moor committed 2024-09-10 22:40:02 -04:00
1 parent 1bc41b4d62
commit b55a8ab54f
1 file changed
+5 -2
+5 -2
View File
@@ -34,8 +34,11 @@ export function useLastVisitedPath(): [string, (path: string) => void] {
* @param path The path to set as the post login path.
*/
export function setPostLoginPath(path: string) {
const key = "postLoginRedirectPath";
if (isValidPostLoginRedirect(path)) {
setCookie("postLoginRedirectPath", path, { expires: 1 });
setCookie(key, path, { expires: 1 });
sessionStorage.setItem(key, path);
}
}
@@ -49,7 +52,7 @@ export function usePostLoginPath() {
const key = "postLoginRedirectPath";
const getter = React.useCallback(() => {
const path = getCookie(key);
const path = sessionStorage.getItem(key) || getCookie(key);
if (path) {
Logger.info("lifecycle", "Spending post login path", { path });