fix(account): submit verification through backend

This commit is contained in:
zetaloop
2026-04-25 14:17:51 +08:00
parent e3572bf86b
commit 2661cfcd8a
3 changed files with 200 additions and 98 deletions
+8 -1
View File
@@ -16,4 +16,11 @@ export { listReviews, listReviewsByOrder, listReviewsByTargetUser } from "./revi
export { getServiceById, listServices, listServicesByPlayer } from "./services"
export { getShopById, getShopByOwnerId, listShops } from "./shops"
export { getWalletBalance, listWalletTransactions } from "./transactions"
export { getCurrentUserForLogin, getUserById, switchCurrentRole, updateCurrentUser } from "./users"
export {
applyCurrentUserVerification,
getCurrentUserForLogin,
getUserById,
listCurrentUserVerifications,
switchCurrentRole,
updateCurrentUser,
} from "./users"
+36
View File
@@ -8,6 +8,25 @@ export type UpdateCurrentUserInput = {
bio?: string
}
export type VerificationMaterials = {
idCardFront: string
idCardBack: string
gameScreenshots?: string[]
voiceDemo?: string
}
export type VerificationRecord = {
id: number
userId: number
userNickname: string
role: UserRole
status: string
materials: Record<string, string>
rejectReason?: string
createdAt: string
reviewedAt?: string
}
export async function getUserById(userId: string): Promise<User | undefined> {
try {
return await httpJson<User>(`/api/v1/users/${encodeURIComponent(userId)}`)
@@ -34,3 +53,20 @@ export async function switchCurrentRole(role: UserRole): Promise<void> {
json: { role },
})
}
export async function applyCurrentUserVerification(input: {
role: UserRole
materials: VerificationMaterials
}): Promise<void> {
await httpJson<unknown>("/api/v1/users/me/verification", {
method: "POST",
json: input,
})
}
export async function listCurrentUserVerifications(): Promise<VerificationRecord[]> {
const res = await httpJson<{ list: VerificationRecord[] }>("/api/v1/users/me/verification", {
cache: "no-store",
})
return res.list
}