summaryrefslogtreecommitdiff
path: root/src/components/Error.js
blob: 086dcea49682e9a76d4f5c1c0335e4137d118a0b (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
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";

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;