feat(client): show actionable customs count on sidebar
This commit is contained in:
@@ -283,3 +283,11 @@ export function merchantCustomsErrorMessage(error: unknown, fallback: string) {
|
||||
export function isMerchantCustomsUnavailable(error: unknown) {
|
||||
return error instanceof ApiError && (error.status === 404 || error.code === 'A0404')
|
||||
}
|
||||
|
||||
|
||||
export async function getMerchantCustomsPendingCount() {
|
||||
const result = await apiRequest<{ pendingCount: string | number }>({ method: 'GET', url: '/merchant/v1/customs/pending-summary' })
|
||||
const count = Number(result.pendingCount)
|
||||
if (result.pendingCount == null || result.pendingCount === '' || !Number.isSafeInteger(count) || count < 0) throw new Error('报关待办数量返回不完整')
|
||||
return count
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user