mirror of
https://github.com/langgenius/dify.git
synced 2026-05-06 10:28:10 +08:00
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:
@ -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">
|
||||
|
||||
|
||||
@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user