mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-24 15:25:46 +00:00
Merge branch 'fix/redirect-error' into 'development'
[HOTFIX/FE] Fixing redirect issues See merge request mbugroup/lti-web-client!94
This commit is contained in:
@@ -25,10 +25,5 @@ export default function Home() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isLoadingUser && !user) {
|
|
||||||
redirectToSSO();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
return <>Loading...</>;
|
return <>Loading...</>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,13 +37,16 @@ const RequireAuth = ({ children }: RequireAuthProps) => {
|
|||||||
|
|
||||||
// Explicitly handle 401 redirect from the component level
|
// Explicitly handle 401 redirect from the component level
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (userErrorResponse?.response?.status === 401) {
|
if (
|
||||||
|
isResponseError(userResponse) &&
|
||||||
|
userErrorResponse?.response?.status === 401
|
||||||
|
) {
|
||||||
// Clear cache to prevent stale data from rendering children
|
// Clear cache to prevent stale data from rendering children
|
||||||
// mutate('/sso/userinfo', undefined, { revalidate: false }); // Optional: if using global mutate
|
// mutate('/sso/userinfo', undefined, { revalidate: false }); // Optional: if using global mutate
|
||||||
setUser(undefined);
|
setUser(undefined);
|
||||||
redirectToSSO();
|
redirectToSSO();
|
||||||
}
|
}
|
||||||
}, [userErrorResponse, setUser]);
|
}, [userErrorResponse, setUser, userResponse]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setIsLoadingUser(isLoadingUserResponse);
|
setIsLoadingUser(isLoadingUserResponse);
|
||||||
|
|||||||
Reference in New Issue
Block a user