fix(transport) : affiche le message 409 (homonyme) à la restauration + virgule décimale dans sanitizeDecimal (ERP-170)
Pull Request — Quality gate / Backend (PHP CS + PHPUnit) (pull_request) Successful in 3m7s
Pull Request — Quality gate / Frontend (lint + Vitest + build) (pull_request) Successful in 1m41s

This commit is contained in:
2026-06-17 16:03:35 +02:00
parent c371057c0b
commit b6b5bb06e8
3 changed files with 13 additions and 5 deletions
@@ -255,6 +255,7 @@ import {
showRestoreAction,
type CarrierPriceRead,
} from '~/modules/transport/utils/forms/carrierMappers'
import { extractApiErrorMessage } from '~/shared/utils/api'
interface SelectOption {
value: string
@@ -481,8 +482,14 @@ async function runToggleArchive(): Promise<void> {
: t('transport.carriers.toast.restoreSuccess'),
})
}
catch {
toast.error({ title: t('transport.carriers.toast.error') })
catch (err) {
// Surface le message back (ex. 409 « homonyme actif » à la restauration),
// propagé exprès par useCarrier ; fallback générique sinon.
const data = (err as { response?: { _data?: unknown } })?.response?._data
toast.error({
title: t('transport.carriers.toast.error'),
message: extractApiErrorMessage(data) || undefined,
})
}
}