forked from baron/baron-sso
devfront 로그인 페이지 auto redirect SSO 진입 추가
This commit is contained in:
@@ -17,12 +17,19 @@ export default function AuthCallbackPage() {
|
||||
}
|
||||
|
||||
if (auth.isAuthenticated) {
|
||||
navigate("/", { replace: true });
|
||||
const returnTo =
|
||||
typeof auth.user?.state === "object" &&
|
||||
auth.user?.state !== null &&
|
||||
"returnTo" in auth.user.state &&
|
||||
typeof auth.user.state.returnTo === "string"
|
||||
? auth.user.state.returnTo
|
||||
: "/clients";
|
||||
navigate(returnTo, { replace: true });
|
||||
} else if (auth.error) {
|
||||
console.error("Auth Error:", auth.error);
|
||||
navigate("/login", { replace: true });
|
||||
}
|
||||
}, [auth.isAuthenticated, auth.error, navigate]);
|
||||
}, [auth.isAuthenticated, auth.error, navigate, auth.user?.state]);
|
||||
|
||||
return <div>Loading Auth...</div>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user