移除前端实名认证回调功能
This commit is contained in:
@@ -37,15 +37,6 @@ export async function Identify(props: {
|
|||||||
}>('/api/user/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: {
|
export async function update(props: {
|
||||||
username: string
|
username: string
|
||||||
email: string
|
email: string
|
||||||
|
|||||||
@@ -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 (
|
|
||||||
<Suspense>
|
|
||||||
<Page1/>
|
|
||||||
</Suspense>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
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 (
|
|
||||||
<div className="w-full min-h-screen flex justify-center items-center bg-blue-50">
|
|
||||||
<Card className="w-full max-w-xs border-none shadow-none bg-white -translate-y-1/3">
|
|
||||||
<CardContent className="flex flex-col items-center gap-4 py-6">
|
|
||||||
{result.status === 'load' ? (
|
|
||||||
<>
|
|
||||||
<Loader2 className="w-16 h-16 text-primary animate-spin"/>
|
|
||||||
<p className="text-primary text-xl">{result.message}</p>
|
|
||||||
<p className="text-weak text-sm">
|
|
||||||
请保持网络畅通
|
|
||||||
</p>
|
|
||||||
</>
|
|
||||||
) : result.status === 'done' ? (
|
|
||||||
<>
|
|
||||||
<CheckCircle className="w-16 h-16 text-done"/>
|
|
||||||
<p className="text-done text-xl">{result.message}</p>
|
|
||||||
<p className="text-weak text-sm">
|
|
||||||
认证已完成,您现在可以关闭此页面
|
|
||||||
</p>
|
|
||||||
</>
|
|
||||||
) : (
|
|
||||||
<>
|
|
||||||
<AlertCircle className="w-16 h-16 text-fail"/>
|
|
||||||
<p className="text-fail text-xl">{result.message}</p>
|
|
||||||
<p className="text-weak text-sm">
|
|
||||||
认证失败,请重新发起认证
|
|
||||||
</p>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</CardContent>
|
|
||||||
</Card>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user