fix(client): correct return inventory carton paging and label printing

This commit is contained in:
2026-09-12 16:16:40 +08:00
parent bee47f1a6c
commit 61a562b828
8 changed files with 201 additions and 23 deletions
+10
View File
@@ -30,3 +30,13 @@ export function isApiEnvelope(value: unknown): value is ApiEnvelope<unknown> {
const record = value as Record<string, unknown>
return typeof record.code === 'string' && typeof record.message === 'string' && 'data' in record
}
// Security failures have no business data, unlike successful API responses.
export function isApiFailure(value: unknown): value is Omit<ApiEnvelope<never>, 'data'> {
if (!value || typeof value !== 'object') return false
const record = value as Record<string, unknown>
return typeof record.code === 'string' && record.code !== '200'
&& typeof record.message === 'string'
&& (record.requestId == null || typeof record.requestId === 'string')
&& (record.traceId == null || typeof record.traceId === 'string')
}