hide chat

This commit is contained in:
hamid zarghami
2025-10-12 15:49:24 +03:30
parent a11e6f97da
commit 4378f0e5ef
16 changed files with 1773 additions and 19 deletions
+29
View File
@@ -7,6 +7,10 @@ import {
UpdateAddressType,
WishlistResponse,
CommentsResponse,
ChatListResponse,
ChatMessagesResponse,
CreateChatRequest,
CreateChatResponse,
} from "../types/ProfileTypes";
export const getProfile = async () => {
@@ -48,3 +52,28 @@ export const changeEmail = async (email: string) => {
const { data } = await axios.post("/user/profile/email/change", { email });
return data;
};
// Chat Services
export const getChatList = async (): Promise<ChatListResponse> => {
const { data } = await axios.get("/chat/list");
return data;
};
export const getChatMessages = async (
chatId: string
): Promise<ChatMessagesResponse> => {
const { data } = await axios.get(`/chat/${chatId}/messages`);
return data;
};
export const createChat = async (
chatData: CreateChatRequest
): Promise<CreateChatResponse> => {
const { data } = await axios.post("/chat/create", chatData);
return data;
};
export const markChatAsRead = async (chatId: string) => {
const { data } = await axios.patch(`/chat/${chatId}/read`);
return data;
};