mirror of
https://github.com/langgenius/dify.git
synced 2026-09-08 02:43:49 +08:00
tweaks
This commit is contained in:
parent
09ca243f0d
commit
d032e236ad
@ -3,7 +3,7 @@
|
|||||||
import type { ReactNode } from 'react'
|
import type { ReactNode } from 'react'
|
||||||
import Cookies from 'js-cookie'
|
import Cookies from 'js-cookie'
|
||||||
import { parseAsBoolean, useQueryState } from 'nuqs'
|
import { parseAsBoolean, useQueryState } from 'nuqs'
|
||||||
import { useCallback, useEffect, useState } from 'react'
|
import { useCallback, useEffect } from 'react'
|
||||||
import {
|
import {
|
||||||
EDUCATION_VERIFY_URL_SEARCHPARAMS_ACTION,
|
EDUCATION_VERIFY_URL_SEARCHPARAMS_ACTION,
|
||||||
EDUCATION_VERIFYING_LOCALSTORAGE_ITEM,
|
EDUCATION_VERIFYING_LOCALSTORAGE_ITEM,
|
||||||
@ -29,7 +29,6 @@ export const AppInitializer = ({
|
|||||||
'oauth_new_user',
|
'oauth_new_user',
|
||||||
parseAsBoolean.withOptions({ history: 'replace' }),
|
parseAsBoolean.withOptions({ history: 'replace' }),
|
||||||
)
|
)
|
||||||
const [isReady, setIsReady] = useState(false)
|
|
||||||
const isSetupFinished = useCallback(async () => {
|
const isSetupFinished = useCallback(async () => {
|
||||||
try {
|
try {
|
||||||
const setUpStatus = await fetchSetupStatusWithCache()
|
const setUpStatus = await fetchSetupStatusWithCache()
|
||||||
@ -87,11 +86,7 @@ export const AppInitializer = ({
|
|||||||
const redirectUrl = resolvePostLoginRedirect()
|
const redirectUrl = resolvePostLoginRedirect()
|
||||||
if (redirectUrl) {
|
if (redirectUrl) {
|
||||||
location.replace(redirectUrl)
|
location.replace(redirectUrl)
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialization completed without redirects; safe to render children
|
|
||||||
setIsReady(true)
|
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
router.replace('/signin')
|
router.replace('/signin')
|
||||||
@ -99,8 +94,5 @@ export const AppInitializer = ({
|
|||||||
})()
|
})()
|
||||||
}, [isSetupFinished, router, pathname, searchParams, oauthNewUser])
|
}, [isSetupFinished, router, pathname, searchParams, oauthNewUser])
|
||||||
|
|
||||||
if (!isReady)
|
|
||||||
return null
|
|
||||||
|
|
||||||
return children
|
return children
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user