Skip to content

Commit

Permalink
sign up flow without react router
Browse files Browse the repository at this point in the history
  • Loading branch information
mrFlick72 committed Jan 7, 2023
1 parent 3db4273 commit 062dd02
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 37 deletions.
13 changes: 8 additions & 5 deletions src/main/frontend/app/signup/SignUpPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import FormInputTextField from "../component/FormInputTextField";
import FormButton from "../component/FormButton";

import {signUp} from "./SignUpRepository";
import {useNavigate} from "react-router";
import FormDatePicker, {ApiDateFormatPattern} from "../component/FormDatePicker";
import {Divider, Grid, ThemeProvider, Typography} from "@mui/material";
import {GroupAdd, VpnKey} from "@mui/icons-material";
import theme from "../component/styles";
import FormInputMask from "../component/FormInputMask";
import {createRoot} from "react-dom/client";

const SignUpPage = () => {
const [email, setEmail] = React.useState("")
Expand All @@ -19,8 +19,6 @@ const SignUpPage = () => {
const [birthDate, setBirthDate] = React.useState("")
const [phone, setPhone] = React.useState("")

let navigate = useNavigate();

return (
<ThemeProvider theme={theme}>
<Template maxWidth="sm">
Expand Down Expand Up @@ -105,7 +103,7 @@ const SignUpPage = () => {
})
.then(r => {
if (r.status === 201) {
navigate("/succeeded", {replace: true});
window.location.href="/sign-up/succeeded";
}
})
}}
Expand All @@ -116,4 +114,9 @@ const SignUpPage = () => {
)
}

export default SignUpPage
if (document.getElementById('app')) {
let features = document.getElementById('features').innerHTML
const container = document.getElementById('app');
const root = createRoot(container);
root.render(<SignUpPage features={features}/>);
}
8 changes: 7 additions & 1 deletion src/main/frontend/app/signup/SuccessfulSignUpPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Template from "../component/Template";
import {Divider, Grid, ThemeProvider, Typography} from "@mui/material";
import {VpnKey} from "@mui/icons-material";
import theme from "../component/styles";
import {createRoot} from "react-dom/client";

const SuccessfulSignUpPage = () => {
return (
Expand All @@ -25,4 +26,9 @@ const SuccessfulSignUpPage = () => {
}


export default SuccessfulSignUpPage
if (document.getElementById('app')) {
let features = document.getElementById('features').innerHTML
const container = document.getElementById('app');
const root = createRoot(container);
root.render(<SuccessfulSignUpPage features={features}/>);
}
26 changes: 0 additions & 26 deletions src/main/frontend/app/signup/index.js

This file was deleted.

4 changes: 1 addition & 3 deletions src/main/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
"react": "18.2.0",
"react-datetime": "3.1.1",
"react-dom": "18.2.0",
"react-imask": "^6.4.3",
"react-router": "^6.3.0",
"react-router-dom": "^6.3.0"
"react-imask": "^6.4.3"
}
}
3 changes: 2 additions & 1 deletion src/main/frontend/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ module.exports = {
healthz: path.resolve(__dirname, './app/healthz/healthz.js'),
login: path.resolve(__dirname, './app/login/LoginPage.js'),
mfa: path.resolve(__dirname, './app/mfa/index.js'),
signup: path.resolve(__dirname, './app/signup/index.js'),
signup: path.resolve(__dirname, './app/signup/SignUpPage.js'),
SuccessfulSignUp: path.resolve(__dirname, './app/signup/SuccessfulSignUpPage.js'),
resetPasswordChallengeSender: path.resolve(__dirname, './app/reset-password/ResetPasswordChallengeSenderPage.js'),
successfulResetPasswordMailChallenge: path.resolve(__dirname, './app/reset-password/SuccessfulResetPasswordMailChallengePage.js'),
resetPassword: path.resolve(__dirname, './app/reset-password/ResetPasswordPage.js'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,13 @@ import org.springframework.web.bind.annotation.SessionAttributes
class SignUpController {

@GetMapping("/sign-up")
fun view(@ModelAttribute("features") features: List<String>, model: Model): String {
fun signUp(@ModelAttribute("features") features: List<String>, model: Model): String {
model.addAttribute("assetBundle", "signup_bundle.js")
return "template"
}
@GetMapping("/sign-up/succeeded")
fun SuccessfulSignUp(@ModelAttribute("features") features: List<String>, model: Model): String {
model.addAttribute("assetBundle", "SuccessfulSignUp_bundle.js")
return "template"
}
}

0 comments on commit 062dd02

Please sign in to comment.