can add image to message

This commit is contained in:
jackiettran
2025-11-10 22:45:29 -05:00
parent d8a927ac4e
commit 4a4eee86a7
8 changed files with 251 additions and 36 deletions

View File

@@ -164,9 +164,12 @@ export const authAPI = {
getStatus: () => api.get("/auth/status"),
verifyEmail: (token: string) => api.post("/auth/verify-email", { token }),
resendVerification: () => api.post("/auth/resend-verification"),
forgotPassword: (email: string) => api.post("/auth/forgot-password", { email }),
verifyResetToken: (token: string) => api.post("/auth/verify-reset-token", { token }),
resetPassword: (token: string, newPassword: string) => api.post("/auth/reset-password", { token, newPassword }),
forgotPassword: (email: string) =>
api.post("/auth/forgot-password", { email }),
verifyResetToken: (token: string) =>
api.post("/auth/verify-reset-token", { token }),
resetPassword: (token: string, newPassword: string) =>
api.post("/auth/reset-password", { token, newPassword }),
};
export const userAPI = {
@@ -241,7 +244,12 @@ export const messageAPI = {
getSentMessages: () => api.get("/messages/sent"),
getConversations: () => api.get("/messages/conversations"),
getMessage: (id: string) => api.get(`/messages/${id}`),
sendMessage: (data: any) => api.post("/messages", data),
sendMessage: (formData: FormData) =>
api.post("/messages", formData, {
headers: {
"Content-Type": "multipart/form-data",
},
}),
markAsRead: (id: string) => api.put(`/messages/${id}/read`),
getUnreadCount: () => api.get("/messages/unread/count"),
};
@@ -304,4 +312,8 @@ export const feedbackAPI = {
api.post("/feedback", data),
};
// Helper to construct message image URLs
export const getMessageImageUrl = (imagePath: string) =>
`${API_BASE_URL}/messages/images/${imagePath}`;
export default api;