mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-04-18 11:49:41 +08:00

Co-authored-by: crazywoola <427733928@qq.com> Co-authored-by: zxhlyh <jasonapring2015@outlook.com>
30 lines
820 B
TypeScript
30 lines
820 B
TypeScript
'use client'
|
|
|
|
import {
|
|
useEffect,
|
|
useMemo,
|
|
} from 'react'
|
|
import {
|
|
useRouter,
|
|
useSearchParams,
|
|
} from 'next/navigation'
|
|
import EducationApplyPage from '@/app/education-apply/education-apply-page'
|
|
import { useProviderContext } from '@/context/provider-context'
|
|
|
|
export default function EducationApply() {
|
|
const router = useRouter()
|
|
const { enableEducationPlan, isEducationAccount } = useProviderContext()
|
|
const searchParams = useSearchParams()
|
|
const token = searchParams.get('token')
|
|
const showEducationApplyPage = useMemo(() => {
|
|
return enableEducationPlan && !isEducationAccount && token
|
|
}, [enableEducationPlan, isEducationAccount, token])
|
|
|
|
useEffect(() => {
|
|
if (!showEducationApplyPage)
|
|
router.replace('/')
|
|
}, [showEducationApplyPage, router])
|
|
|
|
return <EducationApplyPage />
|
|
}
|