feat: temp disable api calls for serverless testing
This commit is contained in:
+28
-25
@@ -30,12 +30,12 @@ function AuthIndex({ }: Props) {
|
||||
const { timerRunning, secondsLeft, restart, stop } = useCountdown(step === AUTH_STEP.ENTER_OTP);
|
||||
|
||||
const isAuthenticated = useAuthStore((state) => state.isAuthenticated)
|
||||
const loginMutation = useLogin()
|
||||
const signupMutation = useSignup()
|
||||
const { run: runUserExistCheck } = useCheckUserExistsLazy()
|
||||
const { run: runOtpRequest } = useOtpRequest();
|
||||
const { run: runOtpValidation } = useOtpValidation();
|
||||
const { run: runResetPassword } = useResetPassword();
|
||||
// const loginMutation = useLogin()
|
||||
// const signupMutation = useSignup()
|
||||
// const { run: runUserExistCheck } = useCheckUserExistsLazy()
|
||||
// const { run: runOtpRequest } = useOtpRequest();
|
||||
// const { run: runOtpValidation } = useOtpValidation();
|
||||
// const { run: runResetPassword } = useResetPassword();
|
||||
|
||||
const resetStates = () => {
|
||||
setNumber('');
|
||||
@@ -57,7 +57,7 @@ function AuthIndex({ }: Props) {
|
||||
useEffect(() => {
|
||||
if (step === AUTH_STEP.ENTER_OTP) {
|
||||
console.log("REQUEST OTP")
|
||||
runOtpRequest(number);
|
||||
// runOtpRequest(number);
|
||||
}
|
||||
}, [step]);
|
||||
|
||||
@@ -100,7 +100,7 @@ function AuthIndex({ }: Props) {
|
||||
else if (target.id === AUTH_PAGE_ELEMENT.RESEND_OTP) {
|
||||
if (!timerRunning) {
|
||||
try {
|
||||
await runOtpRequest(number);
|
||||
// await runOtpRequest(number);
|
||||
restart();
|
||||
} catch {
|
||||
|
||||
@@ -113,7 +113,7 @@ function AuthIndex({ }: Props) {
|
||||
e.preventDefault();
|
||||
if (step == AUTH_STEP.ENTER_NUMBER) {
|
||||
|
||||
if (await runUserExistCheck(number)) {
|
||||
if (false) {
|
||||
setStep(AUTH_STEP.ENTER_PASSWORD)
|
||||
} else {
|
||||
setStep(AUTH_STEP.ENTER_OTP);
|
||||
@@ -121,7 +121,7 @@ function AuthIndex({ }: Props) {
|
||||
}
|
||||
else if (step == AUTH_STEP.ENTER_PASSWORD) {
|
||||
try {
|
||||
await loginMutation.mutateAsync({ phone: number, password })
|
||||
// await loginMutation.mutateAsync({ phone: number, password })
|
||||
console.log("Logged in")
|
||||
}
|
||||
catch (e) {
|
||||
@@ -129,25 +129,27 @@ function AuthIndex({ }: Props) {
|
||||
}
|
||||
}
|
||||
else if (step == AUTH_STEP.ENTER_OTP) {
|
||||
if (!await runOtpValidation({ phone: number, otp })) {
|
||||
setOtp('');
|
||||
console.log('Wrong otp');
|
||||
}
|
||||
// if (!await runOtpValidation({ phone: number, otp })) {
|
||||
// setOtp('');
|
||||
// console.log('Wrong otp');
|
||||
// }
|
||||
setOtp('');
|
||||
stop();
|
||||
if (await runUserExistCheck(number)) {
|
||||
setStep(AUTH_STEP.ENTER_RESET_PASSWORD)
|
||||
} else {
|
||||
setStep(AUTH_STEP.ENTER_NEW_PASSWORD)
|
||||
}
|
||||
// if (await runUserExistCheck(number)) {
|
||||
// setStep(AUTH_STEP.ENTER_RESET_PASSWORD)
|
||||
// } else {
|
||||
// setStep(AUTH_STEP.ENTER_NEW_PASSWORD)
|
||||
// }
|
||||
setStep(AUTH_STEP.ENTER_NEW_PASSWORD)
|
||||
}
|
||||
else if (step == AUTH_STEP.ENTER_RESET_PASSWORD) {
|
||||
console.log("Password changed")
|
||||
try {
|
||||
await runResetPassword({
|
||||
phone: number,
|
||||
newPassword: password,
|
||||
otp
|
||||
})
|
||||
// await runResetPassword({
|
||||
// phone: number,
|
||||
// newPassword: password,
|
||||
// otp
|
||||
// })
|
||||
resetStates();
|
||||
setStep(AUTH_STEP.ENTER_NUMBER)
|
||||
} catch (ex) {
|
||||
@@ -156,7 +158,8 @@ function AuthIndex({ }: Props) {
|
||||
}
|
||||
else if (step == AUTH_STEP.ENTER_NEW_PASSWORD) {
|
||||
try {
|
||||
await signupMutation.mutateAsync({ phone: number, password })
|
||||
// await signupMutation.mutateAsync({ phone: number, password })
|
||||
useAuthStore.getState().isAuthenticated = true;
|
||||
console.log("Signed up")
|
||||
redirect("/")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user