fix(transport) : affiche le message 409 (homonyme) à la restauration + virgule décimale dans sanitizeDecimal (ERP-170)
This commit is contained in:
@@ -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,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user