summaryrefslogtreecommitdiff
path: root/src/components/Error.js
blob: 4d026bcff84e87f3b5a0cc8688388f37d904dc22 (plain)
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
import React from "react";
import PropTypes from "prop-types";

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>
        );
    }
}

export default Error;