summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErnst Widerberg <ernst@sunet.se>2022-06-07 16:50:32 +0200
committerErnst Widerberg <ernst@sunet.se>2022-06-08 11:49:33 +0200
commit15f09c9c9c98f0fb4288a496fda3370e199734ac (patch)
tree0777dc03b5b882d05d1d83bf1529c67173d99879
parent290f996300e637a6e1899ab5f8eabd669b812831 (diff)
Make functional: Error
-rw-r--r--src/components/Error.js52
1 files changed, 25 insertions, 27 deletions
diff --git a/src/components/Error.js b/src/components/Error.js
index 4d026bc..086dcea 100644
--- a/src/components/Error.js
+++ b/src/components/Error.js
@@ -5,33 +5,31 @@ import Alert from "@mui/material/Alert";
import AlertTitle from "@mui/material/AlertTitle";
import Button from "@mui/material/Button";
-class Error extends React.Component {
- static propTypes = {
- clearError: PropTypes.func.isRequired,
- clearToken: PropTypes.func.isRequired,
- error: PropTypes.string.isRequired
- };
-
- render() {
- return (
- <div id="error-container">
- <Alert severity="error">
- <AlertTitle>Internal server error</AlertTitle>
- <p>{this.props.error}</p>
- <Button
- variant="contained"
- color="error"
- onClick={() => {
- this.props.clearToken();
- this.props.clearError();
- }}
- >
- Sign out
- </Button>
- </Alert>
- </div>
- );
- }
+function Error(props) {
+ return (
+ <div id="error-container">
+ <Alert severity="error">
+ <AlertTitle>Internal server error</AlertTitle>
+ <p>{props.error}</p>
+ <Button
+ variant="contained"
+ color="error"
+ onClick={() => {
+ props.clearToken();
+ props.clearError();
+ }}
+ >
+ Sign out
+ </Button>
+ </Alert>
+ </div>
+ );
}
+Error.propTypes = {
+ clearError: PropTypes.func.isRequired,
+ clearToken: PropTypes.func.isRequired,
+ error: PropTypes.string.isRequired
+};
+
export default Error;