Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c130c056f8 |
@@ -1,5 +1,4 @@
|
|||||||
import React, {useState} from "react";
|
import React, {useState} from "react";
|
||||||
// import titleShape from "../../../../assets/images/shape/text-shape-three.svg";
|
|
||||||
import titleShape from "../../../../assets/images/shape/title_shape_3.svg";
|
import titleShape from "../../../../assets/images/shape/title_shape_3.svg";
|
||||||
import AuthLayout from "../../AuthLayout";
|
import AuthLayout from "../../AuthLayout";
|
||||||
import Otp from "./Otp";
|
import Otp from "./Otp";
|
||||||
@@ -68,18 +67,14 @@ export default function VerifyYou() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let apiInput = {
|
let apiInput = {
|
||||||
username: 'anumuduchukwuebuka@gmail.com',
|
username: localStorage.getItem('username'),
|
||||||
pend_uid: 'ec497517-ddb5-4830-a2c4-b7e2a68627de',
|
pend_uid: localStorage.getItem('uuid'),
|
||||||
random_text: otpCode,
|
random_text: otpCode,
|
||||||
mode: 'VERIFY',
|
mode: 'VERIFY',
|
||||||
// loc: 'Desktop',
|
|
||||||
// sessionid: 'ec497517-ddb5-4830-a2c4-b7e2a68627de',
|
|
||||||
// code: otpCode,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await verifyOTP.signupOTPVerify(apiInput);
|
const res = await verifyOTP.signupUser(apiInput)
|
||||||
console.log(res)
|
|
||||||
if(res.status != 200){
|
if(res.status != 200){
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
setErrorMessage({
|
setErrorMessage({
|
||||||
@@ -88,15 +83,33 @@ export default function VerifyYou() {
|
|||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// if status code is 200 proceed
|
|
||||||
setErrorMessage({
|
if(res.status == 200){
|
||||||
success: true,
|
if(res.data.status < 0) { // when resquest is successful but status is not 100
|
||||||
message: 'verification successfully'
|
setLoading(false)
|
||||||
})
|
setErrorMessage({
|
||||||
setTimeout(()=>{
|
success: false,
|
||||||
setLoading(false)
|
message: res.data.error_msg
|
||||||
navigate('/complete-signup', { replace: true })
|
})
|
||||||
}, 1000)
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// if request is successful and status is 100 proceed
|
||||||
|
setErrorMessage({
|
||||||
|
success: true,
|
||||||
|
message: 'verification successfully'
|
||||||
|
})
|
||||||
|
|
||||||
|
//clears the temporary uuid and email in tge local storage
|
||||||
|
localStorage.removeItem('uuid')
|
||||||
|
localStorage.removeItem('username')
|
||||||
|
|
||||||
|
setTimeout(()=>{
|
||||||
|
setLoading(false)
|
||||||
|
navigate('/complete-signup', { replace: true })
|
||||||
|
}, 1000)
|
||||||
|
}
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
setErrorMessage({
|
setErrorMessage({
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ export default function SignUp() {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await userSignup.signupUser(userInfo);
|
const res = await userSignup.signupUser(userInfo);
|
||||||
if(res.status != 200 || res.data.status < 1){
|
if(res.status != 200){
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
setErrorMessage({
|
setErrorMessage({
|
||||||
success: false,
|
success: false,
|
||||||
@@ -110,15 +110,31 @@ export default function SignUp() {
|
|||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// if status code is 200 proceed
|
|
||||||
setErrorMessage({
|
if(res.status == 200){
|
||||||
success: true,
|
if(res.data.status < 0) { // when resquest is successful but status is not 1
|
||||||
message: 'Account created successfully'
|
setLoading(false)
|
||||||
})
|
setErrorMessage({
|
||||||
setTimeout(()=>{
|
success: false,
|
||||||
setLoading(false)
|
message: 'unable to create account'
|
||||||
navigate("/verify-signup", { replace: true })
|
})
|
||||||
}, 1000)
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// if request is successful and status is 1 proceed
|
||||||
|
setErrorMessage({
|
||||||
|
success: true,
|
||||||
|
message: 'Account created successfully'
|
||||||
|
})
|
||||||
|
|
||||||
|
localStorage.setItem('uuid', res.data.uuid) // Stores the user UUID to localstorage
|
||||||
|
localStorage.setItem('username', email) // Stores the user UUID to localstorage
|
||||||
|
|
||||||
|
setTimeout(()=>{
|
||||||
|
setLoading(false)
|
||||||
|
navigate("/verify-signup", { replace: true })
|
||||||
|
}, 1000)
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
setErrorMessage({
|
setErrorMessage({
|
||||||
|
|||||||
@@ -25,11 +25,6 @@ class usersService {
|
|||||||
return this.postAuxEnd("/account", reqData);
|
return this.postAuxEnd("/account", reqData);
|
||||||
}
|
}
|
||||||
|
|
||||||
//SIGNUP OTP VERIFICATION AUTH
|
|
||||||
signupOTPVerify(reqData){
|
|
||||||
return this.postAuxEnd("/signup-code", reqData);
|
|
||||||
}
|
|
||||||
|
|
||||||
getUserReminders(){
|
getUserReminders(){
|
||||||
var reqData = {
|
var reqData = {
|
||||||
member_id: localStorage.getItem("member_id")
|
member_id: localStorage.getItem("member_id")
|
||||||
|
|||||||
Reference in New Issue
Block a user