File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change
1
+ import SvgIcon from './SvgIcon' ;
2
+
3
+ type ExceptionType = '403' | '404' | '500' ;
4
+
5
+ interface Props {
6
+ /**
7
+ * Exception type
8
+ *
9
+ * - 403: no permission
10
+ * - 404: not found
11
+ * - 500: service error
12
+ */
13
+ type : ExceptionType ;
14
+ }
15
+ const iconMap : Record < ExceptionType , string > = {
16
+ '403' : 'no-permission' ,
17
+ '404' : 'not-found' ,
18
+ '500' : 'service-error'
19
+ } ;
20
+ const ExceptionBase : FC < Props > = memo ( ( { type } ) => {
21
+ const { t } = useTranslation ( ) ;
22
+ const nav = useNavigate ( ) ;
23
+
24
+ const onClick = ( ) => {
25
+ nav ( '/' ) ;
26
+ } ;
27
+
28
+ return (
29
+ < div className = "size-full min-h-520px flex-col-center gap-24px overflow-hidden" >
30
+ < div className = "flex text-400px text-primary" >
31
+ < SvgIcon localIcon = { iconMap [ type ] } />
32
+ </ div >
33
+ < AButton
34
+ type = "primary"
35
+ onClick = { onClick }
36
+ >
37
+ { t ( 'common.backToHome' ) }
38
+ </ AButton >
39
+ </ div >
40
+ ) ;
41
+ } ) ;
42
+
43
+ export default ExceptionBase ;
You can’t perform that action at this time.
0 commit comments