File tree 2 files changed +64
-1
lines changed
2 files changed +64
-1
lines changed Original file line number Diff line number Diff line change 1
1
import { Color } from "@material-ui/core"
2
- import { blue , orange , pink } from "@material-ui/core/colors"
2
+ import { blue , orange , pink , red } from "@material-ui/core/colors"
3
3
import { SvgIconProps } from "@material-ui/core/SvgIcon"
4
4
import HomeIcon from "@material-ui/icons/Home"
5
5
import InfoIcon from "@material-ui/icons/Info"
@@ -46,6 +46,16 @@ export class Page implements IEnum<Page> {
46
46
InfoIcon ,
47
47
orange
48
48
)
49
+ public static readonly ERROR = new Page (
50
+ 99 ,
51
+ "Error" ,
52
+ "Error" ,
53
+ "Error | sample" ,
54
+ "Error." ,
55
+ "/error" ,
56
+ InfoIcon ,
57
+ red
58
+ )
49
59
50
60
/**
51
61
* constructor
Original file line number Diff line number Diff line change
1
+ import { Typography } from "@material-ui/core"
2
+ import { createStyles , makeStyles , Theme } from "@material-ui/core/styles"
3
+ import React from "react"
4
+ import { AppContext } from "../components/AppContext"
5
+ import { SpacingPaper } from "../components/atoms"
6
+ import { HeaderArticleContainer } from "../components/organisms"
7
+ import { Layout } from "../components/templates"
8
+ import { Page } from "../constants"
9
+ import { IPagePayload , PageActions } from "../store/page"
10
+
11
+ const useStyles = makeStyles ( ( theme : Theme ) =>
12
+ createStyles ( {
13
+ root : { } ,
14
+ } )
15
+ )
16
+
17
+ interface IProps {
18
+ httpStatusCode : number
19
+ }
20
+
21
+ function Error ( props : IProps ) {
22
+ const { httpStatusCode } = props
23
+ const classes = useStyles ( props )
24
+ return (
25
+ < Layout >
26
+ < HeaderArticleContainer >
27
+ < SpacingPaper >
28
+ < Typography variant = "h5" >
29
+ Http status code { httpStatusCode } error !
30
+ </ Typography >
31
+ </ SpacingPaper >
32
+ </ HeaderArticleContainer >
33
+ </ Layout >
34
+ )
35
+ }
36
+
37
+ /**
38
+ * Server side rendering
39
+ */
40
+ Error . getInitialProps = async ( ctx : AppContext ) : Promise < IProps > => {
41
+ const pagePayload : IPagePayload = {
42
+ selectedPage : Page . ERROR ,
43
+ }
44
+ ctx . store . dispatch ( {
45
+ type : PageActions . changePage . toString ( ) ,
46
+ payload : pagePayload ,
47
+ } )
48
+ return {
49
+ httpStatusCode : ctx . res . statusCode ,
50
+ }
51
+ }
52
+
53
+ export default Error
You can’t perform that action at this time.
0 commit comments