dify/web/app/(commonLayout)/education-apply/page.tsx
Joel d648ce6888
chore: improve the progress of education pay (#35851)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-05-06 10:42:03 +00:00

35 lines
919 B
TypeScript

'use client'
import { useEffect } from 'react'
import EducationApplyPage from '@/app/education-apply/education-apply-page'
import RootLoading from '@/app/loading'
import { useProviderContext } from '@/context/provider-context'
import {
useRouter,
useSearchParams,
} from '@/next/navigation'
export default function EducationApply() {
const router = useRouter()
const {
enableEducationPlan,
isFetchedPlanInfo,
isLoadingEducationAccountInfo,
} = useProviderContext()
const searchParams = useSearchParams()
const token = searchParams.get('token')
useEffect(() => {
if (!isFetchedPlanInfo)
return
if (!enableEducationPlan || !token)
router.replace('/')
}, [enableEducationPlan, isFetchedPlanInfo, router, token])
if (!isFetchedPlanInfo || !enableEducationPlan || !token || isLoadingEducationAccountInfo)
return <RootLoading />
return <EducationApplyPage />
}