mirror of
https://github.com/seerr-team/seerr.git
synced 2026-06-15 11:59:11 -04:00
fix(oidcloginbutton): ensure router is initialized in callback hook
This commit is contained in:
@@ -50,22 +50,25 @@ export default function OidcLoginButton({
|
||||
}
|
||||
}, [provider, intl, onError, router]);
|
||||
|
||||
useEffect(() => {
|
||||
if (loading) return;
|
||||
useEffect(
|
||||
() => {
|
||||
if (!router.isReady || loading) return;
|
||||
|
||||
// OIDC provider has redirected back with an authorization code or error
|
||||
const isCallback = query.code != null || query.error != null;
|
||||
// OIDC provider has redirected back with an authorization code or error
|
||||
const isCallback = query.code != null || query.error != null;
|
||||
|
||||
if (isCallback && getOidcProviderSlug() === provider.slug) {
|
||||
clearOidcProviderSlug();
|
||||
handleCallback();
|
||||
}
|
||||
// Support direct redirect via ?provider=slug query param
|
||||
else if (!isCallback && query.provider === provider.slug) {
|
||||
redirectToLogin();
|
||||
}
|
||||
if (isCallback && getOidcProviderSlug() === provider.slug) {
|
||||
clearOidcProviderSlug();
|
||||
handleCallback();
|
||||
}
|
||||
// Support direct redirect via ?provider=slug query param
|
||||
else if (!isCallback && query.provider === provider.slug) {
|
||||
redirectToLogin();
|
||||
}
|
||||
},
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
[router.isReady]
|
||||
);
|
||||
|
||||
return (
|
||||
<ButtonWithLoader
|
||||
|
||||
Reference in New Issue
Block a user