fix: sync verification state with auth guards
This commit is contained in:
@@ -16,9 +16,14 @@ import {
|
||||
} from "@/components/ui/select"
|
||||
import { Separator } from "@/components/ui/separator"
|
||||
import { Textarea } from "@/components/ui/textarea"
|
||||
import type { UserRole } from "@/lib/types"
|
||||
import { useAuthStore } from "@/store/auth"
|
||||
|
||||
export default function VerifyPage() {
|
||||
const [submitted, setSubmitted] = useState(false)
|
||||
const [verifyRole, setVerifyRole] = useState<UserRole | "">("")
|
||||
const verificationStatus = useAuthStore((state) => state.verificationStatus)
|
||||
const submitVerification = useAuthStore((state) => state.submitVerification)
|
||||
const submitted = Object.values(verificationStatus).includes("pending")
|
||||
|
||||
if (submitted) {
|
||||
return (
|
||||
@@ -68,7 +73,7 @@ export default function VerifyPage() {
|
||||
<CardContent className="space-y-6">
|
||||
<div className="space-y-2">
|
||||
<Label>认证类型</Label>
|
||||
<Select>
|
||||
<Select value={verifyRole} onValueChange={(value) => setVerifyRole(value as UserRole)}>
|
||||
<SelectTrigger>
|
||||
<SelectValue placeholder="选择认证类型" />
|
||||
</SelectTrigger>
|
||||
@@ -115,7 +120,14 @@ export default function VerifyPage() {
|
||||
<p className="text-xs text-muted-foreground">支持 JPG、PNG 格式,单张不超过 5MB</p>
|
||||
</div>
|
||||
|
||||
<Button className="w-full" onClick={() => setSubmitted(true)}>
|
||||
<Button
|
||||
className="w-full"
|
||||
disabled={!verifyRole}
|
||||
onClick={() => {
|
||||
if (!verifyRole) return
|
||||
submitVerification(verifyRole)
|
||||
}}
|
||||
>
|
||||
提交认证申请
|
||||
</Button>
|
||||
</CardContent>
|
||||
|
||||
Reference in New Issue
Block a user