/
index.tsx
59 lines (53 loc) · 1.36 KB
/
index.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/** @module Components.Assets.Notification.Error */
import { Alert, Form, Typography } from 'antd'
import { APIError } from '@/api/error'
/**
* Props
*/
export interface IProps {
error?: APIError
}
/**
* Form error
* @param props Props
* @returns FormError
*/
const FormError: React.FunctionComponent<IProps> = ({ error }) => {
return error ? (
<Form.Item>
<Alert
message={error.render ?? error.title}
type={error.type}
showIcon
description={
error.err && (
<>
{error.err.message && (
<Typography.Text type="danger">
Message: <code>{error.err.message}</code>
</Typography.Text>
)}
{error.err.status && (
<>
<br />
<Typography.Text type="danger">
Status: <code>{error.err.status}</code>
</Typography.Text>
</>
)}
{error.err.info?.message && (
<>
<br />
<Typography.Text type="danger">
Information: <code>{error.err.info?.message}</code>
</Typography.Text>
</>
)}
</>
)
}
/>
</Form.Item>
) : null
}
export default FormError