diff --git a/package.json b/package.json
index 27f62a8..e5e1dc3 100644
--- a/package.json
+++ b/package.json
@@ -9,12 +9,18 @@
"react-router-dom": "^6.15.0",
"react-scripts": "5.0.1"
},
+ "devDependencies": {
+ "eslint": "^8.22.0",
+ "eslint-plugin-simple-import-sort": "^10.0.0"
+ },
"scripts": {
"start": "react-scripts start",
"clean": "rm -rf build",
"build": "NODE_OPTIONS=--openssl-legacy-provider react-scripts build",
"test": "react-scripts test",
- "eject": "react-scripts eject"
+ "eject": "react-scripts eject",
+ "lint": "eslint src/ --ext .js",
+ "lint:fix": "eslint src/ --ext .js --fix"
},
"eslintConfig": {
"extends": "react-app"
diff --git a/src/App.js b/src/App.js
index 5b9131d..055cbe5 100644
--- a/src/App.js
+++ b/src/App.js
@@ -1,11 +1,8 @@
import React from 'react'
-import { BrowserRouter as Router, Routes, Route } from 'react-router-dom'
+import { HashRouter as Router, Routes, Route } from 'react-router-dom'
-import LandingPage from './components/pages/LandingPage'
-import LoginPage from './components/pages/LoginPage'
import RegisterPage from './components/pages/RegisterPage'
-import ForgetPasswordPage from './components/pages/ForgetPasswordPage'
-import HomePage from './components/pages/HomePage'
+import VerifyPage from './components/pages/VerifyPage'
import './App.css'
@@ -16,7 +13,8 @@ export default function App() {
} />
- } />
+ } />
+ } />
diff --git a/src/components/pages/RegisterPage.js b/src/components/pages/RegisterPage.js
index 1f7ffae..98a23dd 100644
--- a/src/components/pages/RegisterPage.js
+++ b/src/components/pages/RegisterPage.js
@@ -5,12 +5,13 @@ import '../../App.css'
import {Link} from "react-router-dom";
export default function SignUpPage() {
- const [username, setUsername] = useState("");
const [email, setEmail] = useState("");
+ const [apiKey, setApiKey] = useState("");
const [message, setMessage] = useState("");
const [error, setError] = useState("");
let handleSubmit = async (e) => {
+ setApiKey("");
setMessage("");
setError("");
@@ -23,13 +24,18 @@ export default function SignUpPage() {
"Content-Type": "application/json",
},
body: JSON.stringify({
- username: username,
+ username: email,
email: email,
}),
});
let resJson = await res.json();
if (res.status === 200) {
- setMessage(`${resJson['api-key']}`);
+ if (resJson['api-key']) {
+ setApiKey(`${resJson['api-key']}`);
+ setMessage(`${resJson['api-key']}`);
+ } else {
+ setMessage("Success");
+ }
} else {
setError(`An error occurred: ${res.status}`);
}
@@ -40,37 +46,33 @@ export default function SignUpPage() {
return (
- {message ?
+ {apiKey ?
Account Created
API Key
- {message}
+ {apiKey}
Save this key. It will not be displayed again.
:
+ message ?
+
+
Account Created
+
+
Verification Required
+ Please check your e-mail for a link to verify your account.
+
+
+ :
- {/*
Join us
*/}
- {/*
Create your personal account
*/
- }