hide chat
This commit is contained in:
@@ -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;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user