|
1 | | -import { axiosInstance } from './axios'; |
| 1 | +import { axiosChatInstance, axiosInstance } from './axios'; |
2 | 2 |
|
3 | 3 | //채팅 목록 불러오기(지난 대화 기록 페이지) |
4 | 4 | export const loadChatList = async () => { |
5 | 5 | const { data } = await axiosInstance.get(`/chat/room-list`); |
6 | 6 | return data; |
7 | 7 | }; |
8 | | - |
9 | | -//채팅방 기록 불러오기(시간 끝난 채팅방 채팅 기록) |
10 | | -//수신,송신자 정보 / messageList 정보 |
11 | | -export const loadChatMessages = async (roomId: number) => { |
12 | | - const { data } = await axiosInstance.get(`/chat/messages/${roomId}`); |
13 | | - return data; |
14 | | -}; |
15 | 8 | //채팅 요청 |
16 | 9 | export const requestChat = async (emotionRecordId: number) => { |
17 | | - const { data } = await axiosInstance.post(`/chat/request`, emotionRecordId, { |
18 | | - headers: { |
19 | | - 'Content-Type': 'application/json', |
20 | | - }, |
21 | | - }); |
| 10 | + const { data } = await axiosInstance.post(`/chat/request?recordId=${emotionRecordId}`, {}); |
22 | 11 | return data; |
23 | 12 | }; |
24 | 13 | //채팅 요청 취소 |
25 | 14 | export const cancelChatRequest = async (emotionRecordId: number) => { |
26 | | - const { data } = await axiosInstance.delete(`/chat/request`, { |
27 | | - headers: { |
28 | | - 'Content-Type': 'application/json', |
29 | | - }, |
30 | | - data: JSON.stringify(emotionRecordId), |
31 | | - }); |
| 15 | + const { data } = await axiosInstance.delete(`/chat/request?recordId=${emotionRecordId}`, {}); |
32 | 16 | return data; |
33 | 17 | }; |
34 | 18 | //채팅방 생성 |
35 | 19 | export const createChatroom = async (emotionRecordId: number) => { |
36 | | - const { data } = await axiosInstance.post( |
37 | | - `/chat/create?recordId=${emotionRecordId}`, |
38 | | - {}, |
39 | | - ); |
| 20 | + const { data } = await axiosInstance.post(`/chat/create?recordId=${emotionRecordId}`, {}); |
40 | 21 | return data; |
41 | 22 | }; |
42 | 23 | //채팅방 닫기 |
43 | 24 | export const closeChatroom = async (chatRoomId: number) => { |
44 | 25 | const { data } = await axiosInstance.post(`/chat/close?chatRoomId=${chatRoomId}`, {}); |
45 | 26 | return data; |
46 | 27 | }; |
| 28 | +//채팅방 기록 불러오기 |
| 29 | +export const loadChatHistory = async (chatRoomId: number) => { |
| 30 | + const { data } = await axiosChatInstance.get(`/chat/history/${chatRoomId}`); |
| 31 | + return data; |
| 32 | +}; |
| 33 | +//채팅방 상세 정보 |
| 34 | +export const loadChatRoomDetail = async (chatRoomId: number) => { |
| 35 | + const { data } = await axiosInstance.get(`/chat/room/detail`, { |
| 36 | + params: { chatRoomId: chatRoomId }, |
| 37 | + }); |
| 38 | + return data; |
| 39 | +}; |
0 commit comments