- Shared utils/apiError.js reads the correct nested error message (with fallbacks); swept 37 views/components off the shallow path so real backend messages (e.g. in-use 409s) surface instead of generic "Failed". - useWarrantyBadge composable: warranty hero status/end-date badge now on PC, equipment, printer, and network detail heroes (one shared fetch feeds the badge + the WarrantyPanel). - Warranties list: client-side search (vendor/level/tag/asset) + pagination; truncate long service levels so they stop blowing out the table width. - "Re-check all" button + POST /warranty/sync/dell?all=true to re-pull dated Dell warranties, not just missing ones. - Deprecate the standalone pxe-images/warranty_sync.py in favor of the plugin. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
10 lines
431 B
JavaScript
10 lines
431 B
JavaScript
// Extract a human-readable message from an API error. The backend nests the
|
|
// message at data.data.error.message (see error_response); older call sites read
|
|
// shallower paths, so try them all before falling back.
|
|
export function apiError(err, fallback = 'Something went wrong') {
|
|
return err?.response?.data?.data?.error?.message
|
|
|| err?.response?.data?.error?.message
|
|
|| err?.response?.data?.message
|
|
|| fallback
|
|
}
|