fleet/frontend/pages/ManageControlsPage/Scripts/components/ScriptUploader/helpers.ts
2023-10-10 19:00:45 -03:00

14 lines
430 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { AxiosResponse } from "axios";
import { IApiError } from "interfaces/errors";
const UPLOAD_ERROR_MESSAGES = {
default: {
message: "Couldnt upload. Please try again.",
},
};
// eslint-disable-next-line import/prefer-default-export
export const getErrorMessage = (err: AxiosResponse<IApiError>) => {
const apiReason = err.data.errors[0].reason;
return apiReason || UPLOAD_ERROR_MESSAGES.default.message;
};