@arteneo/forge
Version:
29 lines (28 loc) • 1.29 kB
TypeScript
import React from "react";
import { AxiosError } from "axios";
import { FormikHelpers, FormikValues } from "formik";
import TranslateVariablesInterface from "../definitions/TranslateVariablesInterface";
interface HandleCatchContextProps {
(error: AxiosError, helpers?: FormikHelpers<FormikValues>): void;
}
interface HandleCatchProviderProps {
children: React.ReactNode;
mode: "production" | "development";
updateValidationErrors?: (children: ErrorsFieldProps, helpers: FormikHelpers<FormikValues>) => void;
}
interface ErrorsFieldErrorsProps {
errors: ErrorMessage[];
children?: ErrorsFieldProps;
}
interface ErrorsFieldProps {
[field: string]: ErrorsFieldErrorsProps;
}
interface ErrorMessage {
message: string;
parameters: TranslateVariablesInterface;
}
declare const AXIOS_CANCELLED_UNMOUNTED = "unmounted";
declare const HandleCatchContext: React.Context<HandleCatchContextProps>;
declare const HandleCatchProvider: ({ children, mode, updateValidationErrors: externalUpdateValidationErrors, }: HandleCatchProviderProps) => React.JSX.Element;
declare const useHandleCatch: () => HandleCatchContextProps;
export { HandleCatchContext, HandleCatchContextProps, HandleCatchProvider, HandleCatchProviderProps, useHandleCatch, AXIOS_CANCELLED_UNMOUNTED, };