fix: error body message -> error (#88)
This commit is contained in:
parent
c9c17340c6
commit
eda869622e
@ -13,9 +13,9 @@ export const extractErrorMessageFromResponse = ({
|
||||
}: FetchBaseQueryError) => {
|
||||
if (
|
||||
typeof data === 'object' &&
|
||||
'message' in data &&
|
||||
typeof data.message === 'string'
|
||||
'error' in data &&
|
||||
typeof data.error === 'string'
|
||||
) {
|
||||
return data.message;
|
||||
return data.error;
|
||||
}
|
||||
};
|
||||
|
@ -9,7 +9,7 @@ export const isErrorMessage = (error: unknown): error is ErrorMessage => typeof
|
||||
|
||||
type ErrorResponse = {
|
||||
success: false;
|
||||
message: ErrorMessage;
|
||||
error: ErrorMessage;
|
||||
};
|
||||
|
||||
export type BaseResponse<Body> = SuccessResponse<Body> | ErrorResponse;
|
||||
|
@ -1,4 +1,4 @@
|
||||
{
|
||||
"success": false,
|
||||
"message": "Не удалось создать заказ"
|
||||
"error": "Не удалось создать заказ"
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
{
|
||||
"success": false,
|
||||
"message": "Не удалось загрузить детали заказа"
|
||||
"error": "Не удалось загрузить детали заказа"
|
||||
}
|
Loading…
Reference in New Issue
Block a user