feat(client): show actionable customs count on sidebar

This commit is contained in:
2026-10-09 18:14:19 +08:00
parent 639b1ae22c
commit c0b151bc15
10 changed files with 136 additions and 2 deletions
+8
View File
@@ -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
}