Skip to content

Commit

Permalink
login file
Browse files Browse the repository at this point in the history
  • Loading branch information
AdityaJ2305 committed Feb 1, 2025
1 parent 66104a8 commit 70a6e2f
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/components/Auth/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import FiltersCache from "@/Utils/FiltersCache";
import ViewCache from "@/Utils/ViewCache";
import routes from "@/Utils/request/api";
import mutate from "@/Utils/request/mutate";
import request from "@/Utils/request/request";
import { TokenData } from "@/types/auth/otpToken";

interface LoginFormData {
Expand Down Expand Up @@ -110,13 +109,7 @@ const Login = (props: LoginProps) => {

// Send OTP Mutation
const { mutate: sendOtp, isPending: sendOtpPending } = useMutation({
mutationFn: async (phone: string) => {
const response = await request(routes.otp.sendOtp, {
body: { phone_number: phone },
silent: true,
});
return response;
},
mutationFn: mutate(routes.otp.sendOtp),
onSuccess: () => {
setIsOtpSent(true);
setOtpError("");
Expand Down Expand Up @@ -280,7 +273,7 @@ const Login = (props: LoginProps) => {

try {
if (!isOtpSent) {
await sendOtp(phone);
await sendOtp({ phone_number: phone });
setIsOtpSent(true);
} else {
await verifyOtp({ phone_number: phone, otp });
Expand Down

0 comments on commit 70a6e2f

Please sign in to comment.