1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
| import React from "react";
| import { ApiContext } from "../../providers/ApiProvider";
| import { cn } from "../../utils/bem";
| import { ErrorWrapper } from "./Error";
|
| export const InlineError = ({ minimal, children, includeValidation, className, style }) => {
| const context = React.useContext(ApiContext);
|
| React.useEffect(() => {
| context.showGlobalError = false;
| }, [context]);
|
| return context.error ? (
| <div className={cn("inline-error").mix(className).toClassName()} style={style}>
| <ErrorWrapper
| possum={false}
| minimal={minimal}
| {...context.errorFormatter(context.error, { includeValidation })}
| />
| {children}
| </div>
| ) : null;
| };
|
|