fix(web): redirect to OAuth authorize page after login instead of /apps (#32177)

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Junyan Chin
2026-02-10 12:32:39 +08:00
committed by GitHub
parent b820c7d1cb
commit 93734d2c9a
2 changed files with 22 additions and 5 deletions

View File

@ -1,7 +1,24 @@
import Link from 'next/link'
import Loading from '@/app/components/base/loading'
'use client'
import Link from 'next/link'
import { useRouter } from 'next/navigation'
import { useEffect } from 'react'
import Loading from '@/app/components/base/loading'
import { OAUTH_AUTHORIZE_PENDING_KEY } from '@/app/account/oauth/authorize/constants'
import { getOAuthPendingRedirect } from '@/app/signin/utils/post-login-redirect'
const Home = () => {
const router = useRouter()
useEffect(() => {
const pendingRedirect = getOAuthPendingRedirect(OAUTH_AUTHORIZE_PENDING_KEY)
if (pendingRedirect) {
router.replace(pendingRedirect)
return
}
router.replace('/apps')
}, [router])
const Home = async () => {
return (
<div className="flex min-h-screen flex-col justify-center py-12 sm:px-6 lg:px-8">

View File

@ -2,7 +2,7 @@ import type { ReadonlyURLSearchParams } from 'next/navigation'
import dayjs from 'dayjs'
import { OAUTH_AUTHORIZE_PENDING_KEY, REDIRECT_URL_KEY } from '@/app/account/oauth/authorize/constants'
function getItemWithExpiry(key: string): string | null {
export function getOAuthPendingRedirect(key: string): string | null {
const itemStr = localStorage.getItem(key)
if (!itemStr)
return null
@ -33,5 +33,5 @@ export const resolvePostLoginRedirect = (searchParams: ReadonlyURLSearchParams)
}
}
return getItemWithExpiry(OAUTH_AUTHORIZE_PENDING_KEY)
return getOAuthPendingRedirect(OAUTH_AUTHORIZE_PENDING_KEY)
}