From 84e4eb7ffe8bd0b95ee91903129bdf6dfd50b2f3 Mon Sep 17 00:00:00 2001 From: Vimal290704 Date: Wed, 12 Nov 2025 19:18:07 +0530 Subject: [PATCH] prog: fixed routing mismatch --- client/src/api/auth.ts | 1 + client/src/api/message.ts | 13 +++++++++---- client/src/api/otp.ts | 2 +- client/src/api/room.ts | 4 ++-- client/src/api/room_resource.ts | 1 + client/src/api/room_section.ts | 1 + client/src/api/user.ts | 6 +++--- 7 files changed, 18 insertions(+), 10 deletions(-) diff --git a/client/src/api/auth.ts b/client/src/api/auth.ts index c67bfc7..a7ea103 100644 --- a/client/src/api/auth.ts +++ b/client/src/api/auth.ts @@ -1,3 +1,4 @@ +/* eslint-disable no-useless-catch */ import api from "@/config/axiosConfig"; import type { LoginCredentials, diff --git a/client/src/api/message.ts b/client/src/api/message.ts index e31ca73..bae250c 100644 --- a/client/src/api/message.ts +++ b/client/src/api/message.ts @@ -1,9 +1,14 @@ +/* eslint-disable no-useless-catch */ import api from "@/config/axiosConfig"; import type { Message } from "@/config/schema/Message"; export const getMessagesOfRoom = async (roomId: string): Promise => { - const response = await api.get(`/messages/${roomId}`, { - withCredentials: true, - }); - return response.data.messages; + try { + const response = await api.get(`/messages/${roomId}`, { + withCredentials: true, + }); + return response.data.messages; + } catch (error) { + throw error; + } }; diff --git a/client/src/api/otp.ts b/client/src/api/otp.ts index 9d45be7..94c729e 100644 --- a/client/src/api/otp.ts +++ b/client/src/api/otp.ts @@ -14,7 +14,7 @@ export const sendEmailOTPVerification = async ( export const verifyOTP = async ( email: string, otp: string -): Promise => { +): Promise => { try { const response = await api.post("/otp/verify-otp", { email, diff --git a/client/src/api/room.ts b/client/src/api/room.ts index dd07346..cb78eed 100644 --- a/client/src/api/room.ts +++ b/client/src/api/room.ts @@ -30,7 +30,7 @@ export const getUserRooms = async (): Promise => { export const joinPublicRoom = async (roomId: string): Promise => { try { - const response = await api.post(`/rooms/join/${roomId}`, { + const response = await api.post(`/rooms/${roomId}/join`, { withCredentials: true, }); @@ -61,7 +61,7 @@ export const updateRoomInfo = async ( roomId: string ): Promise => { try { - const response = await api.post(`/rooms/update/${roomId}`, formData, { + const response = await api.post(`/rooms/${roomId}/update`, formData, { withCredentials: true, }); return response.data; diff --git a/client/src/api/room_resource.ts b/client/src/api/room_resource.ts index 0be2ae9..21c9907 100644 --- a/client/src/api/room_resource.ts +++ b/client/src/api/room_resource.ts @@ -1,3 +1,4 @@ +/* eslint-disable no-useless-catch */ import api from "@/config/axiosConfig"; import type { Resource } from "@/config/schema/Resource"; diff --git a/client/src/api/room_section.ts b/client/src/api/room_section.ts index 0c3e9f6..fa0bc45 100644 --- a/client/src/api/room_section.ts +++ b/client/src/api/room_section.ts @@ -1,3 +1,4 @@ +/* eslint-disable no-useless-catch */ import api from "@/config/axiosConfig"; import type { Section } from "@/config/schema/Section"; diff --git a/client/src/api/user.ts b/client/src/api/user.ts index 6b10a0d..ee7f34a 100644 --- a/client/src/api/user.ts +++ b/client/src/api/user.ts @@ -13,7 +13,7 @@ export const fetchCurrentUser = async (): Promise => { export const updateUser = async (formData: FormData): Promise => { try { - const response = await api.post("/user/update", formData, { + const response = await api.put("/user/update", formData, { withCredentials: true, }); return response.data; @@ -28,7 +28,7 @@ export const changePassword = async ( password: string ): Promise => { try { - await api.post("/user/change-password", { + await api.put("/user/change-password", { email: email, password: password, }); @@ -43,7 +43,7 @@ export const changePassword2 = async ( newPassword: string ): Promise => { try { - await api.post("/user/change-password-with-current", { + await api.put("/user/change-password-with-current", { currentPassword: currentPassword, newPassword: newPassword, });