-
-
Notifications
You must be signed in to change notification settings - Fork 183
/
Copy pathError.tsx
34 lines (28 loc) · 858 Bytes
/
Error.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
import * as React from "react";
import { Link, RouteComponentProps } from 'react-router-dom';
export class ErrorPage extends React.Component<RouteComponentProps<any>, any> {
getErrorCode() {
return this.props.match.params.code;
}
getErrorMessage() {
let message = null;
switch (this.props.match.params.code) {
case 'email-confirm':
message = 'The email confirmation link you used is invalid or expired.'
break;
default:
message = 'An unknown error has occured.'
}
return message;
}
render() {
let code = this.getErrorCode();
return <div>
<h1>Error</h1>
<p>{this.getErrorMessage()}</p>
{code &&
<p>Code: {code}</p>
}
</div>;
}
}