|
|
@@ -6,6 +6,7 @@ import { ReactComponent as EyeIcon } from '../../assets/icons/eye-outline.svg'; |
|
|
|
import { NavLink } from "react-router-dom"; |
|
|
|
import axios from 'axios'; |
|
|
|
import { SERVER_URL } from "../../App"; |
|
|
|
import { authenticateCredentials } from "./Login"; |
|
|
|
|
|
|
|
|
|
|
|
const registerUser = async (name: string, username: string, password: string) => { |
|
|
@@ -40,6 +41,7 @@ export const Signup: React.FC = () => { |
|
|
|
|
|
|
|
function register() { |
|
|
|
registerUser(fullName, userName, password).then(() => { |
|
|
|
window.alert("Registered your email, please wait while we redirect you to verify..."); |
|
|
|
|
|
|
|
setTimeout(() => { |
|
|
|
requestVerification(userName).then(() => { |
|
|
@@ -56,8 +58,15 @@ export const Signup: React.FC = () => { |
|
|
|
|
|
|
|
function verify() { |
|
|
|
verifyUser(userName, otp).then(() => { |
|
|
|
window.alert("Verified user!"); |
|
|
|
window.location.assign("/login"); |
|
|
|
window.alert("Verified user!, Logging you in...."); |
|
|
|
|
|
|
|
authenticateCredentials(userName, password).then((response: any) => { |
|
|
|
localStorage.anamnesisToken = response.data.token; |
|
|
|
window.location.assign('/home'); |
|
|
|
}, () => { |
|
|
|
window.alert("Please check your credentials"); |
|
|
|
}); |
|
|
|
|
|
|
|
}, () => window.alert("Failed Verification, please try again")) |
|
|
|
} |
|
|
|
|
|
|
@@ -87,10 +96,10 @@ export const Signup: React.FC = () => { |
|
|
|
</div> |
|
|
|
|
|
|
|
<button className={styles.submitButton} onClick={() => register()}> |
|
|
|
Next Step |
|
|
|
Next Step (Verification) |
|
|
|
</button> |
|
|
|
|
|
|
|
<NavLink className={styles.otherLinks} to="/Login"> Login? </NavLink> |
|
|
|
<NavLink className={styles.otherLinks} to="/login"> Login? </NavLink> |
|
|
|
|
|
|
|
</section> } |
|
|
|
|
|
|
|