fix(account): submit verification through backend
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user