feat: temp disable api calls for serverless testing

This commit is contained in:
Mahyar Khanbolooki
2025-07-02 20:00:58 +03:30
parent af1fd49664
commit 3deac45466
+26 -23
View File
@@ -30,12 +30,12 @@ function AuthIndex({ }: Props) {
const { timerRunning, secondsLeft, restart, stop } = useCountdown(step === AUTH_STEP.ENTER_OTP); const { timerRunning, secondsLeft, restart, stop } = useCountdown(step === AUTH_STEP.ENTER_OTP);
const isAuthenticated = useAuthStore((state) => state.isAuthenticated) const isAuthenticated = useAuthStore((state) => state.isAuthenticated)
const loginMutation = useLogin() // const loginMutation = useLogin()
const signupMutation = useSignup() // const signupMutation = useSignup()
const { run: runUserExistCheck } = useCheckUserExistsLazy() // const { run: runUserExistCheck } = useCheckUserExistsLazy()
const { run: runOtpRequest } = useOtpRequest(); // const { run: runOtpRequest } = useOtpRequest();
const { run: runOtpValidation } = useOtpValidation(); // const { run: runOtpValidation } = useOtpValidation();
const { run: runResetPassword } = useResetPassword(); // const { run: runResetPassword } = useResetPassword();
const resetStates = () => { const resetStates = () => {
setNumber(''); setNumber('');
@@ -57,7 +57,7 @@ function AuthIndex({ }: Props) {
useEffect(() => { useEffect(() => {
if (step === AUTH_STEP.ENTER_OTP) { if (step === AUTH_STEP.ENTER_OTP) {
console.log("REQUEST OTP") console.log("REQUEST OTP")
runOtpRequest(number); // runOtpRequest(number);
} }
}, [step]); }, [step]);
@@ -100,7 +100,7 @@ function AuthIndex({ }: Props) {
else if (target.id === AUTH_PAGE_ELEMENT.RESEND_OTP) { else if (target.id === AUTH_PAGE_ELEMENT.RESEND_OTP) {
if (!timerRunning) { if (!timerRunning) {
try { try {
await runOtpRequest(number); // await runOtpRequest(number);
restart(); restart();
} catch { } catch {
@@ -113,7 +113,7 @@ function AuthIndex({ }: Props) {
e.preventDefault(); e.preventDefault();
if (step == AUTH_STEP.ENTER_NUMBER) { if (step == AUTH_STEP.ENTER_NUMBER) {
if (await runUserExistCheck(number)) { if (false) {
setStep(AUTH_STEP.ENTER_PASSWORD) setStep(AUTH_STEP.ENTER_PASSWORD)
} else { } else {
setStep(AUTH_STEP.ENTER_OTP); setStep(AUTH_STEP.ENTER_OTP);
@@ -121,7 +121,7 @@ function AuthIndex({ }: Props) {
} }
else if (step == AUTH_STEP.ENTER_PASSWORD) { else if (step == AUTH_STEP.ENTER_PASSWORD) {
try { try {
await loginMutation.mutateAsync({ phone: number, password }) // await loginMutation.mutateAsync({ phone: number, password })
console.log("Logged in") console.log("Logged in")
} }
catch (e) { catch (e) {
@@ -129,25 +129,27 @@ function AuthIndex({ }: Props) {
} }
} }
else if (step == AUTH_STEP.ENTER_OTP) { else if (step == AUTH_STEP.ENTER_OTP) {
if (!await runOtpValidation({ phone: number, otp })) { // if (!await runOtpValidation({ phone: number, otp })) {
// setOtp('');
// console.log('Wrong otp');
// }
setOtp(''); setOtp('');
console.log('Wrong otp');
}
stop(); stop();
if (await runUserExistCheck(number)) { // if (await runUserExistCheck(number)) {
setStep(AUTH_STEP.ENTER_RESET_PASSWORD) // setStep(AUTH_STEP.ENTER_RESET_PASSWORD)
} else { // } else {
// setStep(AUTH_STEP.ENTER_NEW_PASSWORD)
// }
setStep(AUTH_STEP.ENTER_NEW_PASSWORD) setStep(AUTH_STEP.ENTER_NEW_PASSWORD)
} }
}
else if (step == AUTH_STEP.ENTER_RESET_PASSWORD) { else if (step == AUTH_STEP.ENTER_RESET_PASSWORD) {
console.log("Password changed") console.log("Password changed")
try { try {
await runResetPassword({ // await runResetPassword({
phone: number, // phone: number,
newPassword: password, // newPassword: password,
otp // otp
}) // })
resetStates(); resetStates();
setStep(AUTH_STEP.ENTER_NUMBER) setStep(AUTH_STEP.ENTER_NUMBER)
} catch (ex) { } catch (ex) {
@@ -156,7 +158,8 @@ function AuthIndex({ }: Props) {
} }
else if (step == AUTH_STEP.ENTER_NEW_PASSWORD) { else if (step == AUTH_STEP.ENTER_NEW_PASSWORD) {
try { try {
await signupMutation.mutateAsync({ phone: number, password }) // await signupMutation.mutateAsync({ phone: number, password })
useAuthStore.getState().isAuthenticated = true;
console.log("Signed up") console.log("Signed up")
redirect("/") redirect("/")
} }