Merge branch 'fix/redirect-error' into 'development'

[HOTFIX/FE] Fixing redirect issues

See merge request mbugroup/lti-web-client!87
This commit is contained in:
Mitra Berlian Unggas
2025-12-10 09:36:29 +00:00
3 changed files with 20 additions and 7 deletions
+8 -2
View File
@@ -38,11 +38,17 @@ const RequireAuth = ({ children }: RequireAuthProps) => {
// Explicitly handle 401 redirect from the component level
useEffect(() => {
if (userErrorResponse?.response?.status === 401) {
// Clear cache to prevent stale data from rendering children
// mutate('/sso/userinfo', undefined, { revalidate: false }); // Optional: if using global mutate
setUser(undefined);
redirectToSSO();
}
}, [userErrorResponse]);
}, [userErrorResponse, setUser]);
if (isLoadingUserResponse && !userResponse && !userErrorResponse) {
if (
(isLoadingUserResponse && !userResponse && !userErrorResponse) ||
(!userResponse && !userErrorResponse)
) {
return (
<div className='w-full flex flex-row justify-center items-center p-4'>
<span className='loading loading-spinner loading-xl' />