@arteneo/forge
Version:
26 lines (25 loc) • 1.01 kB
TypeScript
import React from "react";
import TranslateVariablesInterface from "../definitions/TranslateVariablesInterface";
interface ErrorContextProps {
error?: number;
setError: (error: undefined | number) => void;
message?: string;
setMessage: (message: undefined | string) => void;
errors: ErrorInterface[];
setErrors: (errors: ErrorInterface[]) => void;
clearErrors: () => void;
addError: (error: ErrorInterface) => void;
}
type ErrorSeverityType = "warning" | "error";
interface ErrorInterface {
message: string;
parameters?: TranslateVariablesInterface;
severity: ErrorSeverityType;
}
interface ErrorProviderProps {
children: React.ReactNode;
}
declare const ErrorContext: React.Context<ErrorContextProps>;
declare const ErrorProvider: ({ children }: ErrorProviderProps) => React.JSX.Element;
declare const useError: () => ErrorContextProps;
export { ErrorContext, ErrorContextProps, ErrorProvider, ErrorProviderProps, useError, ErrorSeverityType, ErrorInterface, };