diff --git a/src/Redux/services/profile.service.ts b/src/Redux/services/profile.service.ts
index 9dcf61d..afa50f0 100644
--- a/src/Redux/services/profile.service.ts
+++ b/src/Redux/services/profile.service.ts
@@ -12,7 +12,7 @@ export const profileApi = createApi({
getUserProfileDetails: builder.query({
query: (id) => `/website/user/${id}`,
- providesTags:["userDetails"]
+ providesTags: ["userDetails"]
}),
updateUserProfileDetails: builder.mutation({
@@ -21,7 +21,18 @@ export const profileApi = createApi({
method: "PUT",
body: userDetails
}),
- invalidatesTags:["userDetails"]
+ invalidatesTags: ["userDetails"]
+ }),
+
+ getUserPasses: builder.query({
+ query: ({ cardMode, sort }) => {
+ const params = new URLSearchParams()
+
+ if(cardMode) params.append('cardMode',cardMode);
+ if(sort) params.append('sort',sort);
+
+ return `/website/passes/all?${params.toString()}`
+ }
})
})
@@ -29,5 +40,6 @@ export const profileApi = createApi({
export const {
useGetUserProfileDetailsQuery,
- useUpdateUserProfileDetailsMutation
+ useUpdateUserProfileDetailsMutation,
+ useGetUserPassesQuery
} = profileApi;
\ No newline at end of file
diff --git a/src/components/LoginModal.tsx b/src/components/LoginModal.tsx
index b4378d0..b15cdc6 100644
--- a/src/components/LoginModal.tsx
+++ b/src/components/LoginModal.tsx
@@ -96,12 +96,20 @@ export function LoginModal({ isOpen, onClose }: LoginModalProps) {
};
const handleOTPKeyDown = (index: number, e: React.KeyboardEvent) => {
- if (e.key === 'Backspace' && !otp[index] && index > 0) {
+ if (e.key === "Backspace" && !otp[index] && index > 0) {
const prevInput = document.querySelector(
`input[data-otp-index="${index - 1}"]`
) as HTMLInputElement;
prevInput?.focus();
}
+
+ // ✅ Trigger verify on Enter if all 6 digits are filled
+ if (e.key === "Enter") {
+ const otpString = otp.join("");
+ if (otpString.length === 6) {
+ handleVerifyLogin();
+ }
+ }
};
// Rest of your functions remain the same
@@ -140,10 +148,10 @@ export function LoginModal({ isOpen, onClose }: LoginModalProps) {
}).unwrap();
const userData = {
- userId:response?.user?.id,
+ userId: response?.user?.id,
email: response?.email || email,
name: response?.name || email.split('@')[0].charAt(0).toUpperCase() + email.split('@')[0].slice(1),
- accessToken:response?.accessToken,
+ accessToken: response?.accessToken,
};
login(userData);
@@ -292,7 +300,7 @@ export function LoginModal({ isOpen, onClose }: LoginModalProps) {
}}
className="w-full text-sm text-gray-600 hover:text-gray-800 font-poppins cursor-pointer"
>
- Didn't receive OTP?
+ Didn't receive OTP?
Send again
{/* Send again */}
diff --git a/src/main.tsx b/src/main.tsx
index b8619fc..cfff6d7 100644
--- a/src/main.tsx
+++ b/src/main.tsx
@@ -9,7 +9,7 @@ import { Toaster } from "sonner";
createRoot(document.getElementById("root")!).render(