diff --git a/src/actions/user.ts b/src/actions/user.ts index f868abc..4c1acff 100644 --- a/src/actions/user.ts +++ b/src/actions/user.ts @@ -37,15 +37,6 @@ export async function Identify(props: { }>('/api/user/identify', props) } -export async function IdentifyCallback(props: { - id: string -}) { - return await callPublic<{ - success: boolean - message: string - }>('/api/user/identify/callback', props) -} - export async function update(props: { username: string email: string diff --git a/src/app/(api)/identify/callback/page.tsx b/src/app/(api)/identify/callback/page.tsx deleted file mode 100644 index e14b907..0000000 --- a/src/app/(api)/identify/callback/page.tsx +++ /dev/null @@ -1,90 +0,0 @@ -'use client' -import {Suspense, useEffect, useState} from 'react' -import {useSearchParams} from 'next/navigation' -import {IdentifyCallback} from '@/actions/user' -import {Card, CardContent} from '@/components/ui/card' -import {CheckCircle, AlertCircle, Loader2} from 'lucide-react' - -export type PageProps = {} - -export default function Page(props: PageProps) { - return ( - - - - ) -} - -function Page1() { - const params = useSearchParams() - const success = params.get('success') === 'true' - const id = params.get('id') || '' - - const [result, setResult] = useState({ - status: 'load', - message: '处理中', - }) - - useEffect(() => { - if (success) { - IdentifyCallback({id}).then((resp) => { - if (!resp.success) { - setResult({ - status: 'fail', - message: resp.message || '获取活体检测结果失败', - }) - } - else { - const data = resp.data - setResult({ - status: data.success ? 'done' : 'fail', - message: data.message || data.success - ? '认证已完成' - : '认证失败', - }) - } - }) - } - else { - setResult({ - status: 'fail', - message: '未完成认证', - }) - } - // eslint-disable-next-line react-hooks/exhaustive-deps - }, []) - - return ( -
- - - {result.status === 'load' ? ( - <> - -

{result.message}

-

- 请保持网络畅通 -

- - ) : result.status === 'done' ? ( - <> - -

{result.message}

-

- 认证已完成,您现在可以关闭此页面 -

- - ) : ( - <> - -

{result.message}

-

- 认证失败,请重新发起认证 -

- - )} -
-
-
- ) -}