summaryrefslogtreecommitdiff
path: root/src/components/Error.js
blob: 56cc09c14ab22c183b8602cd664cce62e77feeae (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
import React from "react";
import PropTypes from "prop-types";
import { Button, Message } from "semantic-ui-react";

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">
                <Message negative>
                    <Message.Header>Internal server error</Message.Header>
                    <p>{this.props.error}</p>
                    <Button
                        color="red"
                        onClick={() => {
                            this.props.clearToken();
                            this.props.clearError();
                        }}
                    >
                        Sign out
                    </Button>
                </Message>
            </div>
        );
    }
}

export default Error;