Skip to content

Commit d7bfe39

Browse files
authored
COMP-730 fix redirect after login (#743)
1 parent bb47a8b commit d7bfe39

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

compliance-web/src/routes/_authenticated.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ function Auth() {
1111

1212
useEffect(() => {
1313
if (!isAuthenticated && !isLoading) {
14+
const cleanPathname = window.location.pathname.replace(/^\/compliance/, ''); // Remove "/compliance" prefix if present
15+
window.sessionStorage.setItem("redirectUrl", cleanPathname + window.location.search);
1416
signinRedirect({ extraQueryParams: { kc_idp_hint: "idir" } });
1517
}
1618
}, [isAuthenticated, isLoading, signinRedirect]);

compliance-web/src/routes/oidc-callback.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ function OidcCallback() {
3535
}
3636

3737
if (!isLoading && isAuthenticated && isValidStaffUser) {
38-
return <Navigate to="/ce-database/case-files"></Navigate>;
38+
const redirectUrl = window.sessionStorage.getItem("redirectUrl") || "/ce-database/case-files";
39+
return <Navigate to={redirectUrl} replace />;
3940
}
4041

4142
return <h1>Authentication in progress...</h1>;

0 commit comments

Comments
 (0)