diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/components/Error.js | 52 |
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; |
