Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

822 B
Raw Blame
'use client'

import type { GetFeaturesResponse } from '@dify/contracts/api/console/features/types.gen'
import { useQuery } from '@tanstack/react-query'
import { redirect } from '@/next/navigation'
import { consoleQuery } from '@/service/console'
import EducationApplyPage from './application-form'

const selectEducationPlan = ({ billing, education }: GetFeaturesResponse) => ({
  enabled: education.enabled,
  plan: billing.subscription.plan,
})

export default function EducationApplyRoute({ token }: { token: string }) {
  const featuresQuery = useQuery(
    consoleQuery.features.get.queryOptions({ select: selectEducationPlan }),
  )

  if (featuresQuery.isPending) return null

  if (!featuresQuery.data?.enabled) return redirect('/')

  return <EducationApplyPage token={token} plan={featuresQuery.data.plan} />
}