Skip to content

Commit

Permalink
error page migrated
Browse files Browse the repository at this point in the history
  • Loading branch information
mrFlick72 committed Sep 2, 2023
1 parent b02522f commit 66b5cd9
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 29 deletions.
8 changes: 0 additions & 8 deletions src/main/frontend/app/errors/400ErrorPage.js

This file was deleted.

8 changes: 0 additions & 8 deletions src/main/frontend/app/errors/404ErrorPage.js

This file was deleted.

8 changes: 0 additions & 8 deletions src/main/frontend/app/errors/500ErrorPage.js

This file was deleted.

16 changes: 14 additions & 2 deletions src/main/frontend/app/errors/DefaultGenericErrorPage.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import React from "react";
import ReactDOM from "react-dom";


import {ThemeProvider, Typography} from "@mui/material";
import theme from "../component/styles";
Expand All @@ -8,12 +10,13 @@ import {SentimentVeryDissatisfied} from "@mui/icons-material";
interface DefaultGenericErrorPageProps {
messages: string
}

interface ErrorMessage {
defaultMessage: string
}

const DefaultGenericErrorPage: React.FC<DefaultGenericErrorPageProps> = ({messages}) => {
let errors : ErrorMessage = JSON.parse(messages)
let errors: ErrorMessage = JSON.parse(messages)
return <ThemeProvider theme={theme}>
<Template maxWidth="sm">
<Typography variant="h3" component="h3">
Expand All @@ -25,4 +28,13 @@ const DefaultGenericErrorPage: React.FC<DefaultGenericErrorPageProps> = ({messag

}

export default DefaultGenericErrorPage
if (document.getElementById('app')) {
let errors: string = "{}"
let htmlElement = document.getElementById('errors');

if (htmlElement) {
errors = htmlElement.innerHTML || "{}"
}

ReactDOM.render(<DefaultGenericErrorPage messages={errors}/>, document.getElementById('app'));
}
6 changes: 3 additions & 3 deletions src/main/frontend/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ const BUID_DIR = path.resolve(__dirname + "/dist");
module.exports = {
entry: {
"default_error": path.resolve(__dirname, './app/errors/DefaultGenericErrorPage.tsx'),
"404_error": path.resolve(__dirname, './app/errors/400ErrorPage.js'),
"400_error": path.resolve(__dirname, './app/errors/404ErrorPage.js'),
"500_error": path.resolve(__dirname, './app/errors/500ErrorPage.js'),
"404_error": path.resolve(__dirname, './app/errors/DefaultGenericErrorPage.tsx'),
"400_error": path.resolve(__dirname, './app/errors/DefaultGenericErrorPage.tsx'),
"500_error": path.resolve(__dirname, './app/errors/DefaultGenericErrorPage.tsx'),
login: path.resolve(__dirname, './app/login/LoginPage.js'),
mfa: path.resolve(__dirname, './app/mfa/index.js'),
signup: path.resolve(__dirname, './app/signup/SignUpPage.js'),
Expand Down

0 comments on commit 66b5cd9

Please sign in to comment.