diff --git a/packages/frontend/core/src/components/affine/auth/oauth.tsx b/packages/frontend/core/src/components/affine/auth/oauth.tsx index c5c851302..9ca5f84e7 100644 --- a/packages/frontend/core/src/components/affine/auth/oauth.tsx +++ b/packages/frontend/core/src/components/affine/auth/oauth.tsx @@ -25,7 +25,7 @@ const OAuthProviderMap: Record< }, }; -export function OAuth() { +export function OAuth({ redirectUri }: { redirectUri?: string | null }) { const serverConfig = useService(ServerConfigService).serverConfig; const oauth = useLiveData(serverConfig.features$.map(r => r?.oauth)); const oauthProviders = useLiveData( @@ -42,11 +42,21 @@ export function OAuth() { } return oauthProviders?.map(provider => ( - + )); } -function OAuthProvider({ provider }: { provider: OAuthProviderType }) { +function OAuthProvider({ + provider, + redirectUri, +}: { + provider: OAuthProviderType; + redirectUri?: string | null; +}) { const { icon } = OAuthProviderMap[provider]; const authService = useService(AuthService); const [isConnecting, setIsConnecting] = useState(false); @@ -54,7 +64,7 @@ function OAuthProvider({ provider }: { provider: OAuthProviderType }) { const onClick = useAsyncCallback(async () => { try { setIsConnecting(true); - await authService.signInOauth(provider); + await authService.signInOauth(provider, redirectUri); } catch (err) { console.error(err); notify.error({ message: 'Failed to sign in, please try again.' }); @@ -62,7 +72,7 @@ function OAuthProvider({ provider }: { provider: OAuthProviderType }) { setIsConnecting(false); mixpanel.track('OAuth', { provider }); } - }, [authService, provider]); + }, [authService, provider, redirectUri]); return ( + + )} + + ); +}; diff --git a/packages/frontend/core/src/router.tsx b/packages/frontend/core/src/router.tsx index d362881f3..44179d521 100644 --- a/packages/frontend/core/src/router.tsx +++ b/packages/frontend/core/src/router.tsx @@ -96,6 +96,10 @@ export const topLevelRoutes = [ path: '/redirect-proxy', lazy: () => import('./pages/redirect'), }, + { + path: '/subscribe', + lazy: () => import('./pages/subscribe'), + }, { path: '*', lazy: () => import('./pages/404'),