feat(mobile): 接入实名认证与商品详情客服入口
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
|
||||
import { apiClient, unwrapData } from '@/shared/api/client'
|
||||
import type { ApiResponse } from '@/shared/api/types'
|
||||
|
||||
export interface RealnameStatus {
|
||||
status: string
|
||||
provider?: string
|
||||
provider_order_no?: string
|
||||
masked_name?: string
|
||||
masked_id_no?: string
|
||||
verified_at?: string
|
||||
fail_reason?: string
|
||||
}
|
||||
|
||||
export function fetchRealnameStatus() {
|
||||
return unwrapData<RealnameStatus>(
|
||||
apiClient.get<ApiResponse<RealnameStatus>>('/realname/status')
|
||||
)
|
||||
}
|
||||
|
||||
export function useRealnameStatus(enabled = true) {
|
||||
return useQuery({
|
||||
queryKey: ['realname-status'],
|
||||
queryFn: fetchRealnameStatus,
|
||||
enabled,
|
||||
staleTime: 10_000,
|
||||
})
|
||||
}
|
||||
|
||||
export function startRealname(name: string, idNo: string) {
|
||||
return unwrapData<RealnameStatus>(
|
||||
apiClient.post<ApiResponse<RealnameStatus>>('/realname/start', {
|
||||
name,
|
||||
id_no: idNo,
|
||||
})
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user