Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions client/src/api/auth.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-useless-catch */
import api from "@/config/axiosConfig";
import type {
LoginCredentials,
Expand Down
13 changes: 9 additions & 4 deletions client/src/api/message.ts
Original file line number Diff line number Diff line change
@@ -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<Message[]> => {
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;
}
};
2 changes: 1 addition & 1 deletion client/src/api/otp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const sendEmailOTPVerification = async (
export const verifyOTP = async (
email: string,
otp: string
): Promise<Object> => {
): Promise<object> => {
try {
const response = await api.post("/otp/verify-otp", {
email,
Expand Down
4 changes: 2 additions & 2 deletions client/src/api/room.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const getUserRooms = async (): Promise<StudyRoom[]> => {

export const joinPublicRoom = async (roomId: string): Promise<StudyRoom> => {
try {
const response = await api.post(`/rooms/join/${roomId}`, {
const response = await api.post(`/rooms/${roomId}/join`, {
withCredentials: true,
});

Expand Down Expand Up @@ -61,7 +61,7 @@ export const updateRoomInfo = async (
roomId: string
): Promise<StudyRoom> => {
try {
const response = await api.post(`/rooms/update/${roomId}`, formData, {
const response = await api.post(`/rooms/${roomId}/update`, formData, {
withCredentials: true,
});
return response.data;
Expand Down
1 change: 1 addition & 0 deletions client/src/api/room_resource.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-useless-catch */
import api from "@/config/axiosConfig";
import type { Resource } from "@/config/schema/Resource";

Expand Down
1 change: 1 addition & 0 deletions client/src/api/room_section.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-useless-catch */
import api from "@/config/axiosConfig";
import type { Section } from "@/config/schema/Section";

Expand Down
6 changes: 3 additions & 3 deletions client/src/api/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const fetchCurrentUser = async (): Promise<User> => {

export const updateUser = async (formData: FormData): Promise<User> => {
try {
const response = await api.post("/user/update", formData, {
const response = await api.put("/user/update", formData, {
withCredentials: true,
});
return response.data;
Expand All @@ -28,7 +28,7 @@ export const changePassword = async (
password: string
): Promise<void> => {
try {
await api.post("/user/change-password", {
await api.put("/user/change-password", {
email: email,
password: password,
});
Expand All @@ -43,7 +43,7 @@ export const changePassword2 = async (
newPassword: string
): Promise<void> => {
try {
await api.post("/user/change-password-with-current", {
await api.put("/user/change-password-with-current", {
currentPassword: currentPassword,
newPassword: newPassword,
});
Expand Down