Files
order_site/apps/frontend/src/services/douyu-fulfillment.ts
T

47 lines
1.2 KiB
TypeScript

import { apiGet, apiPost } from '@/lib/http'
import type {
DouyuCustomerFulfillment,
DouyuCustomerPlatform,
DouyuCustomerSystem,
} from '@/types/douyu-fulfillment'
export function fetchDouyuFulfillment(orderNo: string) {
return apiGet<DouyuCustomerFulfillment>(
`/api/v1/douyu-fulfillment/${encodeURIComponent(orderNo)}`,
)
}
export function saveDouyuProfile(
orderNo: string,
input: {
roleName: string
platform: DouyuCustomerPlatform
system: DouyuCustomerSystem
},
) {
return apiPost<DouyuCustomerFulfillment>(
`/api/v1/douyu-fulfillment/${encodeURIComponent(orderNo)}/profile`,
input,
)
}
export function startDouyuBinding(orderNo: string, forceRefresh = false) {
return apiPost<DouyuCustomerFulfillment>(
`/api/v1/douyu-fulfillment/${encodeURIComponent(orderNo)}/binding/start`,
{ forceRefresh },
)
}
export function pollDouyuBinding(orderNo: string) {
return apiGet<DouyuCustomerFulfillment>(
`/api/v1/douyu-fulfillment/${encodeURIComponent(orderNo)}/binding/status`,
)
}
export function confirmDouyuBinding(orderNo: string) {
return apiPost<DouyuCustomerFulfillment>(
`/api/v1/douyu-fulfillment/${encodeURIComponent(orderNo)}/binding/confirm`,
{},
)
}