fix and update
This commit is contained in:
@@ -34,6 +34,7 @@ import {
|
||||
subscribeApiReady,
|
||||
subscribeApiNotReady,
|
||||
} from '@/lib/api';
|
||||
import { resolvePostPinAuthRedirect } from '@/lib/auth-post-pin-redirect';
|
||||
import { finalizeFedcmLogin, isFedcmLoginPopup, shouldFinalizeFedcmLogin } from '@/lib/fedcm-login-bridge';
|
||||
import { FedcmApiLoginStatusBridge } from './fedcm-api-login-status';
|
||||
import { usePublicSettings } from './public-settings-provider';
|
||||
@@ -682,12 +683,25 @@ export function AuthProvider({ children }: { children: React.ReactNode }) {
|
||||
setIsLoading(false);
|
||||
}
|
||||
|
||||
if (pathname.startsWith('/auth/') && !isFedcmLoginPopup()) {
|
||||
router.replace('/');
|
||||
if (isFedcmLoginPopup()) {
|
||||
await finalizeFedcmLogin(response.accessToken);
|
||||
return;
|
||||
}
|
||||
|
||||
if (shouldFinalizeFedcmLogin(pathname) || isFedcmLoginPopup()) {
|
||||
const postPinRedirect =
|
||||
typeof window !== 'undefined'
|
||||
? resolvePostPinAuthRedirect(pathname, window.location.search)
|
||||
: null;
|
||||
|
||||
if (postPinRedirect !== null) {
|
||||
if (shouldFinalizeFedcmLogin(pathname)) {
|
||||
await finalizeFedcmLogin(response.accessToken);
|
||||
}
|
||||
router.replace(postPinRedirect);
|
||||
return;
|
||||
}
|
||||
|
||||
if (shouldFinalizeFedcmLogin(pathname)) {
|
||||
await finalizeFedcmLogin(response.accessToken);
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user