Minor hacks

This commit is contained in:
Thomas E Lackey 2023-08-15 05:47:50 +00:00
parent c9ee91c5a8
commit ac26f6f46d
3 changed files with 9 additions and 5 deletions

View File

@ -1,6 +1,7 @@
{
"name": "react-login-page",
"version": "0.1.0",
"homepage": "/newuser/",
"private": true,
"dependencies": {
"react": "^16.8.6",

View File

@ -14,9 +14,9 @@ export default function App() {
<Router>
<div>
<Switch>
<Route exact path="/" component={ RegisterPage } />
<Route exact path="/newuser/" component={ RegisterPage } />
{/*<Route path="/login" component={ LoginPage } />*/}
<Route path="/register" component={ RegisterPage } />
<Route path="/newuser/register" component={ RegisterPage } />
{/*<Route path="/forget-password" component={ ForgetPasswordPage } />*/}
{/*<Route path="/home" component={ HomePage } />*/}
</Switch>
@ -42,4 +42,4 @@ const FooterStyle = {
margin: 0,
width: "100%",
opacity: ".5"
}
}

View File

@ -13,6 +13,9 @@ export default function SignUpPage() {
try {
let res = await fetch("/register", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
username: username,
email: email,
@ -20,7 +23,7 @@ export default function SignUpPage() {
});
let resJson = await res.json();
if (res.status === 200) {
setMessage("User created successfully");
setMessage(`API Key: ${resJson['api-key']}`);
} else {
setMessage("Some error occured");
}
@ -32,7 +35,7 @@ export default function SignUpPage() {
return (
<div className="text-center m-5-auto">
<h2>Join us</h2>
{/*<h2>Join us</h2>*/}
{/*<h5>Create your personal account</h5>*/}
<form onSubmit={handleSubmit} action="">
<p>