diff --git a/dist.zip b/dist.zip index a1d885b..a9a71db 100644 Binary files a/dist.zip and b/dist.zip differ diff --git a/src/api/apiEndpoints.js b/src/api/apiEndpoints.js index 5018fb4..7400150 100644 --- a/src/api/apiEndpoints.js +++ b/src/api/apiEndpoints.js @@ -1,65 +1,71 @@ export const API_ENDPOINTS = { LOGOUT: "logout", - TERMS_AND_POLICIES_PRIVACY:"terms-and-policies", - // registration api's -PERSONAL_DETAILS_MASTER :"personal_details_masters", -CASTE_MASTER : "get_caste_masters", -SUB_CASTE_MASTER : "get_sub_caste_masters", -CITY_MASTER : "get_district_masters", -STAR_MASTER : "get_star_masters", -MOBILE_SEND_OTP: "send_otp", -MOBILE_VERIFY_OTP: "verify_otp", + TERMS_AND_POLICIES_PRIVACY: "terms-and-policies", + // registration api's + PERSONAL_DETAILS_MASTER: "personal_details_masters", + CASTE_MASTER: "get_caste_masters", + SUB_CASTE_MASTER: "get_sub_caste_masters", + CITY_MASTER: "get_district_masters", + STAR_MASTER: "get_star_masters", + MOBILE_SEND_OTP: "send_otp", + MOBILE_VERIFY_OTP: "verify_otp", -EDUCATION_DETAILS_MASTER: "educational_details_masters", -EDUCATION_LIST_API:"get_education", + EDUCATION_DETAILS_MASTER: "educational_details_masters", + EDUCATION_LIST_API: "get_education", -FAMILY_DETAILS_MASTER: "family_details_masters", // family details master api + FAMILY_DETAILS_MASTER: "family_details_masters", // family details master api -LIFESTYLE_DETAILS_MASTER:"lifetstyle_details_masters", + LIFESTYLE_DETAILS_MASTER: "lifetstyle_details_masters", -PREFERED_PARTNER_DETAILS_MASTER:"prefered_details_masters", + PREFERED_PARTNER_DETAILS_MASTER: "prefered_details_masters", -REGISTER_STEP1: "register", // register api -REGISTER_STEP2:"update_educational_details", // educational details updated api -REGSITER_STEP3:"update_family_details", // family details updated api -REGISTER_STEP4:"update_lifestyle_details", // lifestyle details updated api -REGISTER_STEP5:"update_preferred_details", // partner preference details updated api -PREVIEW_DETAILS: "get_preview_details", -REVIEWS: "reviews", + REGISTER_STEP1: "register", // register api + REGISTER_STEP2: "update_educational_details", // educational details updated api + REGSITER_STEP3: "update_family_details", // family details updated api + REGISTER_STEP4: "update_lifestyle_details", // lifestyle details updated api + REGISTER_STEP5: "update_preferred_details", // partner preference details updated api + PREVIEW_DETAILS: "get_preview_details", + REVIEWS: "reviews", -// edit api's autopapulated + // edit api's autopapulated -EDIT_PERSONAL_DETAILS: "get_personal_details", -EDIT_EDUCATION_DETAILS: "get_educational_details", -EDIT_FAMILY_DETAILS: "get_family_details", -EDIT_LIFESTYLE_DETAILS: "get_lifestyle_details", -EDIT_PREFERED_PARTNER_DETAILS: "get_preferred_details", + EDIT_PERSONAL_DETAILS: "get_personal_details", + EDIT_EDUCATION_DETAILS: "get_educational_details", + EDIT_FAMILY_DETAILS: "get_family_details", + EDIT_LIFESTYLE_DETAILS: "get_lifestyle_details", + EDIT_PREFERED_PARTNER_DETAILS: "get_preferred_details", -// delete api + // delete api -DELETE_ACCOUNT: "delete_account", -PHONE_NUMBER_VISIBILITY: "get_phone_number_visibility", -UPDATE_PHONE_NUMBER_VISIBILITY: "update_phone_number_visibility", -CHAT_ALERT_NOTIFICATION:"get_chat_alert_notification", -UPDATE_CHAT_ALERT_NOTIFICATION:"update_chat_alert_notification", -PROFILE_PROTECT_API:"get_profile_protection", -UPDATE_PROFILE_PROTECT_API:"update_profile_protection", -MATCH_ALERT:"get_match_alert", -UPDATE_MATCH_ALERT:"update_match_alert", -WHO_CAN_VIEW_MESSAGE:"get_who_can_message_me", -UPDATE_WHO_CAN_VIEW_MESSAGE:"update_who_can_message_me", -CONTACT_US:"get_contact_us", -BE_SAFE_ONLINE:"get_be_safe_online", -NOTIFICATION_LIST:"notification/lists", -NOTIFICATION_COUNT:"notification/un_read_count", + DELETE_ACCOUNT: "delete_account", + PHONE_NUMBER_VISIBILITY: "get_phone_number_visibility", + UPDATE_PHONE_NUMBER_VISIBILITY: "update_phone_number_visibility", + CHAT_ALERT_NOTIFICATION: "get_chat_alert_notification", + UPDATE_CHAT_ALERT_NOTIFICATION: "update_chat_alert_notification", + PROFILE_PROTECT_API: "get_profile_protection", + UPDATE_PROFILE_PROTECT_API: "update_profile_protection", + MATCH_ALERT: "get_match_alert", + UPDATE_MATCH_ALERT: "update_match_alert", + WHO_CAN_VIEW_MESSAGE: "get_who_can_message_me", + UPDATE_WHO_CAN_VIEW_MESSAGE: "update_who_can_message_me", + CONTACT_US: "get_contact_us", + BE_SAFE_ONLINE: "get_be_safe_online", + NOTIFICATION_LIST: "notification/lists", + NOTIFICATION_COUNT: "notification/un_read_count", -// filter with profiles list api's -PROFILES_FILTER_LIST:"profiles/lists", -PROFILES_FILTER_MASTER:"profiles/filter/masters", - - -DASHBOARD_API:"dashboard", -HEADER_API:"header_data", -SHORTLIST_API:"shortlist_profile", + // filter with profiles list api's + PROFILES_FILTER_LIST: "profiles/lists", + PROFILES_FILTER_MASTER: "profiles/filter/masters", + DASHBOARD_API: "dashboard", + HEADER_API: "header_data", + SHORTLIST_API: "shortlist_profile", + BLOCK_PROFILE_LIST: "block_profile_list", + REPORT_PROFILE_LIST: "report_profile_list", + PROFILE_DETAIL: "profiles/detail", + INTEREST_LIST: "interest_lists", + UPDATE_INTEREST_STATUS: "update_interest_status", + CHAT_LIST: "chat/lists", + CHAT_MESSAGES: (id) => `chat/${id}/messages`, + UNREAD_CHAT_COUNT: "chat/un_read_chat_count", }; diff --git a/src/components/common/MatrimonySwipeCards.jsx b/src/components/common/MatrimonySwipeCards.jsx index 06d37a5..b04d07f 100644 --- a/src/components/common/MatrimonySwipeCards.jsx +++ b/src/components/common/MatrimonySwipeCards.jsx @@ -242,7 +242,7 @@ const navigate = useNavigate(); >
e.stopPropagation()} className="bg-white rounded-2xl shadow-xl overflow-hidden select-none">
-
+
{ const [profileDrawerOpen, setProfileDrawerOpen] = useState(false); const [deleteModalOpen, setDeleteModalOpen] = useState(false); const [logoutModalOpen, setLogoutModalOpen] = useState(false); + const queryClient = useQueryClient(); const { personalDetails } = useSelector((state) => state.registerform); @@ -189,17 +191,104 @@ const ProfileHeader = () => { return res.data; }, enabled: !!auth, + refetchInterval: 60000, + }); + + // WebSocket for real-time updates - Match the robust strategy from ChatPage + const profileId = localStorage.getItem("profile_id"); + const userId = localStorage.getItem("user_id"); + + const wsChannels = useMemo(() => { + const channels = []; + if (profileId && profileId !== "null") { + channels.push(`user-chat-notification${profileId}`); + channels.push(`user-chat-notification.${profileId}`); + channels.push(`partner-chat${profileId}`); + channels.push(`partner-chat.${profileId}`); + } + if (userId && userId !== "null") { + channels.push(`user-notification${userId}`); + channels.push(`user-notification.${userId}`); + } + return [...new Set(channels.filter(Boolean))]; + }, [profileId, userId]); + + const { messages: wsMessages, isConnected } = useWebSocket(wsChannels); + const processedMsgCount = useRef(wsMessages.length); + + useEffect(() => { + if (isConnected) { + console.log("[HEADER-WS] Connected, refreshing badges..."); + queryClient.invalidateQueries({ queryKey: ["notificationCount"] }); + queryClient.invalidateQueries({ queryKey: ["unreadChatCount"] }); + } + }, [isConnected, queryClient]); + + useEffect(() => { + if (wsMessages.length > processedMsgCount.current) { + const newWsMsgs = wsMessages.slice(processedMsgCount.current); + console.log(`[HEADER-WS] Detected ${newWsMsgs.length} new signals.`); + + let shouldRefresh = false; + + newWsMsgs.forEach(lastMsg => { + if (lastMsg.event?.startsWith('pusher:')) return; + + // Lenient detection matching ChatPage + const isMessageEvent = lastMsg.event?.toLowerCase().includes('message') || + lastMsg.event?.toLowerCase().includes('chat') || + lastMsg.event?.toLowerCase().includes('notification'); + + if (isMessageEvent) { + console.log(`[HEADER-WS] Relevant event detected: ${lastMsg.event}, refreshing counts...`); + shouldRefresh = true; + } + }); + + if (shouldRefresh) { + queryClient.invalidateQueries({ queryKey: ["unreadChatCount"] }); + queryClient.invalidateQueries({ queryKey: ["notificationCount"] }); + } + + processedMsgCount.current = wsMessages.length; + } + }, [wsMessages, queryClient]); + + const { data: chatCountData } = useQuery({ + queryKey: ["unreadChatCount"], + queryFn: async () => { + const res = await axiosInstance.get(API_ENDPOINTS.UNREAD_CHAT_COUNT); + return res.data; + }, + enabled: !!auth, + refetchInterval: 30000, }); const notificationCount = notificationData?.count || 0; - - + const chatCount = chatCountData?.count || 0; const { data: headerData } = useQuery({ queryKey: ["headerDetails"], queryFn: getHeaderDetails, enabled: !!auth, }); + + // AUTO-SYNC: Recover missing IDs from Header API data + useEffect(() => { + if (headerData?.myDetails) { + const myId = headerData.myDetails.id || headerData.myDetails.profile_id; + const uId = headerData.myDetails.user_id; + if (myId && (localStorage.getItem("profile_id") === "null" || !localStorage.getItem("profile_id"))) { + localStorage.setItem("profile_id", myId); + console.log("Header API auto-synced profileId:", myId); + } + if (uId && (localStorage.getItem("user_id") === "null" || !localStorage.getItem("user_id"))) { + localStorage.setItem("user_id", uId); + console.log("Header API auto-synced userId:", uId); + } + } + }, [headerData]); + const apiProfileImage = headerData?.myDetails?.profile; const handleMenuClick = (item) => { @@ -327,10 +416,17 @@ const ProfileHeader = () => { {getNavIcon(index)} - {label} +
+ {label} {label === "Notifications" && notificationCount > 0 && ( - {notificationCount} + + {notificationCount} + + )} + {label === "Messages" && chatCount > 0 && ( + + {chatCount} + )}
} /> @@ -376,7 +472,10 @@ const ProfileHeader = () => { items={NAV_LINKS.map(link => link.label)} color="#034E08" activeItem={currentLabel} - badges={{ "Notifications": notificationCount }} + badges={{ + "Notifications": notificationCount, + "Messages": chatCount + }} onItemClick={(item) => { setSelectedItem(item); const link = NAV_LINKS.find(l => l.label === item); @@ -386,7 +485,7 @@ const ProfileHeader = () => { {(auth ? ( - + @@ -395,7 +494,7 @@ const ProfileHeader = () => { - ):( ))} diff --git a/src/components/landing/AppPromoteSection.jsx b/src/components/landing/AppPromoteSection.jsx index 72bfa87..2f9da02 100644 --- a/src/components/landing/AppPromoteSection.jsx +++ b/src/components/landing/AppPromoteSection.jsx @@ -125,7 +125,7 @@ const AppPromoteSection = () => { className="grid grid-cols-1 md:grid-cols-3 gap-6 mt-16 max-w-6xl mx-auto" > {features.map((feature, index) => ( -
+
{
{/* Custom Swiper Styles */} - - - - - ); -} - -// Main Component -export default function InterestSendPage() { - const [value, setValue] = useState("2"); - - const handleChange = (event, newValue) => { - setValue(newValue); - }; - - const [intreasteactiveTab, setIntreasteactiveTab] = useState("receivedintreaste"); - - // Sample data for different categories - const profilesData = { - received: [ - { - id: 1, - name: "Priya Sharma", - matrimonyId: "PS2847593", - age: 24, - height: "5.4", - lastseen: "Last seen 4 Nov 2025", - education: "MBA / Marketing Manager", - location: "Mumbai", - image: - bride1, - isPremium: true, - }, - { - id: 2, - name: "Ananya Reddy", - matrimonyId: "AR2847594", - age: 23, - height: "5.3", - lastseen: "Last seen 4 Nov 2025", - education: "B.Tech / Software Engineer", - location: "Hyderabad", - image: - bride2, - isPremium: false, - }, - { - id: 3, - name: "Divya Patel", - matrimonyId: "DP2847595", - age: 25, - height: "5.5", - lastseen: "Last seen 4 Nov 2025", - education: "CA / Chartered Accountant", - location: "Ahmedabad", - image: - bride3, - isPremium: true, - }, - { - id: 4, - name: "Divya Patel", - matrimonyId: "DP2847595", - age: 25, - height: "5.5", - lastseen: "Last seen 4 Nov 2025", - education: "CA / Chartered Accountant", - location: "Ahmedabad", - image: - groom2, - isPremium: true, - }, - ], - sent: [ - { - id: 5, - name: "Kavya Iyer", - matrimonyId: "KI2847596", - age: 22, - height: "5.2", - lastseen: "Last seen 4 Nov 2025", - education: "BCA / Data Analyst", - location: "Chennai", - image: - bride4, - isPremium: true, - }, - { - id: 6, - name: "Neha Singh", - matrimonyId: "NS2847597", - age: 26, - height: "5.6", - lastseen: "Last seen 4 Nov 2025", - education: "MD / Doctor", - location: "Delhi", - image: - bride1, - isPremium: false, - }, - { - id: 7, - name: "Neha Singh", - matrimonyId: "NS2847597", - age: 26, - height: "5.6", - lastseen: "Last seen 4 Nov 2025", - education: "MD / Doctor", - location: "Delhi", - image: - bride2, - isPremium: false, - }, - { - id: 8, - name: "Neha Singh", - matrimonyId: "NS2847597", - age: 26, - height: "5.6", - lastseen: "Last seen 4 Nov 2025", - education: "MD / Doctor", - location: "Delhi", - image: - bride3, - isPremium: false, - }, - ], - accepted: [ - { - id: 9, - name: "Shreya Nair", - matrimonyId: "SN2847598", - age: 24, - height: "5.4", - lastseen: "Last seen 4 Nov 2025", - education: "B.Sc / Nurse", - location: "Kochi", - image: - groom1, - isPremium: true, - }, - { - id: 10, - name: "Meera Desai", - matrimonyId: "MD2847599", - age: 23, - height: "5.3", - lastseen: "Last seen 4 Nov 2025", - education: "BBA / HR Manager", - location: "Pune", - image: - groom2, - isPremium: false, - }, - { - id: 11, - name: "Riya Kumar", - matrimonyId: "RK2847600", - age: 25, - height: "5.5", - lastseen: "Last seen 4 Nov 2025", - education: "M.Tech / Project Manager", - location: "Bangalore", - image: - groom3, - isPremium: true, - }, - { - id: 12, - name: "Riya Kumar", - matrimonyId: "RK2847600", - age: 25, - height: "5.5", - lastseen: "Last seen 4 Nov 2025", - education: "M.Tech / Project Manager", - location: "Bangalore", - image: - groom1, - isPremium: true, - }, - ], - rejected: [ - { - id: 13, - name: "Sanya Joshi", - matrimonyId: "SJ2847601", - age: 27, - height: "5.7", - lastseen: "Last seen 4 Nov 2025", - education: "LLB / Lawyer", - location: "Nagpur", - image: - groom4, - isPremium: false, - }, - { - id: 14, - name: "Sanya Joshi", - matrimonyId: "SJ2847601", - age: 27, - height: "5.7", - lastseen: "Last seen 4 Nov 2025", - education: "LLB / Lawyer", - location: "Nagpur", - image: - groom3, - isPremium: false, - }, - { - id: 15, - name: "Sanya Joshi", - matrimonyId: "SJ2847601", - age: 27, - height: "5.7", - lastseen: "Last seen 4 Nov 2025", - education: "LLB / Lawyer", - location: "Nagpur", - image: - bride1, - isPremium: false, - }, - { - id: 16, - name: "Sanya Joshi", - matrimonyId: "SJ2847601", - age: 27, - height: "5.7", - lastseen: "Last seen 4 Nov 2025", - education: "LLB / Lawyer", - location: "Nagpur", - image: - bride2, - isPremium: false, - }, - ], - }; - - - // Step 1: Use state for profiles -const [profiles, setProfiles] = useState({ - received: [...profilesData.received], - sent: [...profilesData.sent], - accepted: [...profilesData.accepted], - rejected: [...profilesData.rejected], -}); - -// Corrected handleDelete to update profiles state properly - const handleDelete = (id) => { - setProfiles((prev) => { - const updated = { ...prev }; - Object.keys(updated).forEach((key) => { - updated[key] = updated[key].filter((p) => p.id !== id); - }); - return updated; - }); - toast.success("Profile deleted successfully!", { - duration: 2000, - }); - }; +}; +const ProfileCard = ({ profile, tabIndex, onStatusUpdate }) => { + const navigate = useNavigate(); return ( -
-
- {/* Header */} - -
-
setIntreasteactiveTab("receivedintreaste")}> -

- Received Interest -

-

- Manage your matrimony profile interests -

+
navigate(`/profile-details/${profile.id}`)} + className="bg-white rounded-xl shadow-sm border border-gray-200 overflow-hidden hover:shadow-md transition-shadow cursor-pointer p-4" + > +
+ {/* Profile Image */} +
+ {profile.name} + {profile.is_paid_member && ( +
+ +
+ )}
-
setIntreasteactiveTab("sendintreaste")}> -

- Send Interest -

-

- Manage your matrimony profile interests -

+ + {/* Profile Info */} +
+
+

{profile.name}

+ +
+ +
+
+ ID: {profile.member_id} + + + {profile.last_seen_at} + +
+ +
+ + {profile.district_name}, {profile.state_name} +
+ +
+ + {profile.age || "N/A"} yrs • {profile.height || "N/A"} ft +
+ +
+ + {profile.religion_name} / {profile.caste_name} +
+ + {profile.annual_income_name && ( +
+ + {profile.annual_income_name} +
+ )} +
-
- {intreasteactiveTab === "receivedintreaste" && ( +
-<> - - {/* MUI Tabs */} - - - + {tabIndex === 0 && profile.statusReceived === 'pending' ? ( + <> + + + + ) : (tabIndex === 1 || tabIndex === 2 || (tabIndex === 0 && profile.statusReceived === 'accept')) ? ( + <> + + + + ) : null}
); -} +}; + +export default InterestSendPage; diff --git a/src/pages/ProfileDetailPage.jsx b/src/pages/ProfileDetailPage.jsx index 0857d04..aa8c914 100644 --- a/src/pages/ProfileDetailPage.jsx +++ b/src/pages/ProfileDetailPage.jsx @@ -1,19 +1,58 @@ +import React, { useState, useEffect } from 'react'; import { useParams } from "react-router-dom"; import MatrimonyProfile from "../components/profiledetail/MatrimonyProfile" import PartnerPreferences from "../components/profiledetail/PartnerPreferences" import MatchingList from "../components/profiledashboard/MatchingList"; +import { getProfileDetail } from "../services/profileActionApi"; +import { CircularProgress, Box } from "@mui/material"; const ProfileDetailPage = () => { const { id } = useParams(); + const [data, setData] = useState(null); + const [loading, setLoading] = useState(true); + + useEffect(() => { + const fetchDetail = async () => { + setLoading(true); + try { + const res = await getProfileDetail(id); + setData(res); + } catch (error) { + console.error("Failed to fetch profile details:", error); + } finally { + setLoading(false); + } + }; + if (id) { + fetchDetail(); + } + }, [id]); + + if (loading) { + return ( + + + + ); + } + + if (!data) { + return ( +
+ Profile details not found. +
+ ); + } + return ( <>
- - - + + +
- ) -} + ); +}; -export default ProfileDetailPage \ No newline at end of file +export default ProfileDetailPage; \ No newline at end of file diff --git a/src/pages/auth/LoginPage.jsx b/src/pages/auth/LoginPage.jsx index 0119a95..c898c0c 100644 --- a/src/pages/auth/LoginPage.jsx +++ b/src/pages/auth/LoginPage.jsx @@ -74,6 +74,13 @@ const LoginPage = () => { localStorage.setItem("access_token", token); setAccessToken(token); + // Store profile_id and user_id for WebSocket channels + const profileId = data?.profile_id || data?.data?.profile_id; + const userId = data?.user_id || data?.data?.user_id; + + if (profileId) localStorage.setItem("profile_id", profileId); + if (userId) localStorage.setItem("user_id", userId); + toast.success("Login Successful!"); navigate("/dashboard-home"); } else { diff --git a/src/redux/registrationFormSlice.jsx b/src/redux/registrationFormSlice.jsx index 5c9419b..bb20037 100644 --- a/src/redux/registrationFormSlice.jsx +++ b/src/redux/registrationFormSlice.jsx @@ -5,49 +5,72 @@ const registrationformSlice = createSlice({ initialState: { personalDetails: { name: "", - mobileNumber: "", + mobile: "", + email: "", gender: "", - dob: "", height: "", weight: "", - maritalStatus: "", - religion: "", - profileFor: "", - caste: "", - subCaste: "", + marital_status: "", + religion: 1, // Default Hindu + profile_for: "", + caste: 1, // Default Naidu + sub_caste: "", + willing_to_marry: "", + inter_caste_parents: "", + inter_caste_parents_details: "", gothram: "", - raasi: "", - star: "", - bloodGroup: "", - email: "", + do_you_speak_telugu: "", + about_us: "", + known_languages: [], + mother_language: "", + complexion: "", + physical_status: "", password: "", confirmPassword: "", + dob: "", + raasi: "", + star: "", state: "", city: "", pincode: "", profiles: [], + verifiedMobileNumber: "", }, educationalDetails: { - collegeName: "", - employeeType: "", - qualification: "", - fieldOfStudy: "", + study_field: "", + education: "", + education_detail: "", + college_name: "", + employee_type: "", occupation: "", - organization: "", - income: "", - workLocation: "", + occupation_detail: "", + company_name: "", + income_currency: "INR", + annual_income: "", + work_country: 1, + work_city: "", + work_state: "", + work_district: "", + address: "", }, familyDetails: { fatherName: "", fatherOccupation: "", motherName: "", motherOccupation: "", - brotherCount: 0, - sisterCount: 0, + brotherCount: "", + sisterCount: "", brothers: [], sisters: [], familyStatus: "", nativePlace: "", + familyCountry: "", + familyState: "", + familyDistrict: "", + familyCity: "", + address: "", + expectationDetails: "", + willingToGoAbroad: "", }, lifestyleDetails: { diets: [], @@ -114,14 +137,38 @@ const registrationformSlice = createSlice({ state.partnerPreferences = { ...state.partnerPreferences, ...action.payload }; }, - submitForm: (state) => { - console.log("Form Submitted:", { - personalDetails: state.personalDetails, - educationalDetails: state.educationalDetails, - familyDetails: state.familyDetails, - lifestyleDetails: state.lifestyleDetails, - partnerPreferences: state.partnerPreferences, - }); + clearAllStepsFrom: (state, action) => { + const step = action.payload; + if (step <= 2) { + state.educationalDetails = { + study_field: "", education: "", education_detail: "", college_name: "", + employee_type: "", occupation: "", occupation_detail: "", company_name: "", + income_currency: "INR", annual_income: "", work_country: "", work_state: "", + work_district: "", work_city: "", address: "", + }; + } + if (step <= 3) { + state.familyDetails = { + fatherName: "", fatherOccupation: "", motherName: "", motherOccupation: "", + brotherCount: "", sisterCount: "", brothers: [], sisters: [], + familyStatus: "", nativePlace: "", familyCountry: "", familyState: "", + familyDistrict: "", familyCity: "", address: "", expectationDetails: "", + willingToGoAbroad: "", + }; + } + if (step <= 4) { + state.lifestyleDetails = { + diets: "", hobbies: [], dob: "", tob: "", placeOfBirth: "", + graha: { 1: [], 2: [], 3: [], 4: [], 5: [], 6: [], 7: [], 8: [], 9: [], 10: [], 11: [], 12: [] }, + amsam: { 1: [], 2: [], 3: [], 4: [], 5: [], 6: [], 7: [], 8: [], 9: [], 10: [], 11: [], 12: [] }, + }; + } + if (step <= 5) { + state.partnerPreferences = { + ageRange: "", castes: [], subCastes: [], occupations: [], educations: [], + hobbies: [], annualIncome: "", states: [], districts: [], + }; + } }, @@ -279,6 +326,7 @@ export const { updateFamilyDetails, updateLifestyleDetails, updatePartnerPreferences, + clearAllStepsFrom, submitForm, preloadDummyProfile, } = registrationformSlice.actions; diff --git a/src/services/chatApi.js b/src/services/chatApi.js new file mode 100644 index 0000000..3ad5878 --- /dev/null +++ b/src/services/chatApi.js @@ -0,0 +1,34 @@ +import axiosInstance from "../api/axiosInstance"; +import { API_ENDPOINTS } from "../api/apiEndpoints"; + +export const getChatList = async (searchValue = "") => { + try { + // Add timestamp to prevent caching + const response = await axiosInstance.get(`${API_ENDPOINTS.CHAT_LIST}?search_value=${searchValue}&_t=${Date.now()}`); + return response.data; + } catch (error) { + console.error("Error fetching chat list:", error); + throw error; + } +}; + +export const getChatMessages = async (chatId, page = 1) => { + try { + const response = await axiosInstance.get(`${API_ENDPOINTS.CHAT_MESSAGES(chatId)}?page=${page}`); + return response.data; + } catch (error) { + console.error("Error fetching chat messages:", error); + throw error; + } +}; + +export const sendMessage = async (chatId, message) => { + try { + // Correct endpoint based on user request: chat/message/send?chat_id={id}&message={text} + const response = await axiosInstance.post(`chat/message/send?chat_id=${chatId}&message=${encodeURIComponent(message)}`); + return response.data; + } catch (error) { + console.error("Error sending message:", error); + throw error; + } +}; diff --git a/src/services/profileActionApi.js b/src/services/profileActionApi.js new file mode 100644 index 0000000..87c40ae --- /dev/null +++ b/src/services/profileActionApi.js @@ -0,0 +1,65 @@ +import axiosInstance from "../api/axiosInstance"; +import { API_ENDPOINTS } from "../api/apiEndpoints"; + +export const getBlockedProfiles = async () => { + try { + const response = await axiosInstance.get(API_ENDPOINTS.BLOCK_PROFILE_LIST); + return response.data; + } catch (error) { + console.error("Error fetching blocked profiles:", error); + throw error; + } +}; + +export const getReportedProfiles = async () => { + try { + const response = await axiosInstance.get(API_ENDPOINTS.REPORT_PROFILE_LIST); + return response.data; + } catch (error) { + console.error("Error fetching reported profiles:", error); + throw error; + } +}; + +export const unblockProfile = async (profileId) => { + try { + const response = await axiosInstance.post(`unblock_profile?profile_id=${profileId}`); + return response.data; + } catch (error) { + console.error("Error unblocking profile:", error); + throw error; + } +}; + +export const getProfileDetail = async (profile_id) => { + try { + const response = await axiosInstance.get(`${API_ENDPOINTS.PROFILE_DETAIL}?profile_id=${profile_id}`); + return response.data; + } catch (error) { + console.error("Error fetching profile detail:", error); + throw error; + } +}; + +export const getInterestList = async (tab, type) => { + try { + const response = await axiosInstance.get(`${API_ENDPOINTS.INTEREST_LIST}?tab=${tab}&type=${type}`); + return response.data; + } catch (error) { + console.error("Error fetching interest list:", error); + throw error; + } +}; + +export const updateInterestStatus = async (profile_id, status) => { + try { + const response = await axiosInstance.post(API_ENDPOINTS.UPDATE_INTEREST_STATUS, { + profile_id, + status + }); + return response.data; + } catch (error) { + console.error("Error updating interest status:", error); + throw error; + } +}; diff --git a/src/services/shortlistapi.js b/src/services/shortlistapi.js index a97c931..5351bc1 100644 --- a/src/services/shortlistapi.js +++ b/src/services/shortlistapi.js @@ -10,7 +10,9 @@ export const shortlistProfile = async (profileId) => { }; export const sendInterest = async (profileId) => { - const response = await axiosInstance.post(`interest?profile_id=${profileId}`); + const response = await axiosInstance.post(`interest_send`, { + profile_id: profileId // ✅ sent in request body + }); if (response.data?.status === "error") { throw new Error(response.data.message || "Failed to send interest"); }