( apiErrorResponse: ApiErrorResponse, )
| 52 | error !== undefined && error !== null; |
| 53 | |
| 54 | export const mapApiErrorToFieldErrors = ( |
| 55 | apiErrorResponse: ApiErrorResponse, |
| 56 | ): FieldErrors => { |
| 57 | const result: FieldErrors = {}; |
| 58 | |
| 59 | if (apiErrorResponse.validations) { |
| 60 | for (const error of apiErrorResponse.validations) { |
| 61 | result[error.field] = error.detail || "Invalid value"; |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | return result; |
| 66 | }; |
| 67 | |
| 68 | /** |
| 69 | * |
no outgoing calls
no test coverage detected