Skip to content

Commit

Permalink
Clean up code surrounding setting UNAUTHORIZED_PATH
Browse files Browse the repository at this point in the history
  • Loading branch information
ryandberger committed Aug 27, 2024
1 parent 9d0061b commit 71b4818
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/AuthnLogin/AuthnLogin.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const AuthnLogin = ({ stripes }) => {
* @see OIDCRedirect
*/
if (okapi.authnUrl && window.location.pathname !== '/') {
setUnauthorizedPathToSession(window.location.pathname + window.location.search);
setUnauthorizedPathToSession();
}

// If only 1 tenant is defined in config (in either okapi or config.tenantOptions) set to okapi to be accessed there
Expand Down
4 changes: 2 additions & 2 deletions src/loginServices.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ export const setTokenExpiry = async (te) => {
const UNAUTHORIZED_PATH = 'unauthorized_path';
export const removeUnauthorizedPathFromSession = () => sessionStorage.removeItem(UNAUTHORIZED_PATH);
export const setUnauthorizedPathToSession = (pathname) => {
const path = pathname ?? `${window.location.pathname}${window.location.search}`;
const path = pathname || `${window.location.pathname}${window.location.search}`;
if (!path.startsWith('/logout')) {
sessionStorage.setItem(UNAUTHORIZED_PATH, pathname ?? `${window.location.pathname}${window.location.search}`);
sessionStorage.setItem(UNAUTHORIZED_PATH, path);
}
};
export const getUnauthorizedPathFromSession = () => sessionStorage.getItem(UNAUTHORIZED_PATH);
Expand Down

0 comments on commit 71b4818

Please sign in to comment.