@pubuduth-aplicy/chat-ui 2.2.17 → 2.2.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -4,7 +4,6 @@ import { useMessageMutation } from "../../hooks/mutations/useSendMessage";
|
|
|
4
4
|
import { useChatContext } from "../../providers/ChatProvider";
|
|
5
5
|
import useChatUIStore from "../../stores/Zustant";
|
|
6
6
|
import { FilePreview, FileType } from "../common/FilePreview";
|
|
7
|
-
import { getApiClient } from "../../lib/api/apiClient";
|
|
8
7
|
import { MessageStatus } from "../../types/type";
|
|
9
8
|
import { Path } from "../../lib/api/endpoint";
|
|
10
9
|
import { getChatConfig } from "../../Chat.config";
|
|
@@ -37,7 +36,7 @@ interface Attachment {
|
|
|
37
36
|
|
|
38
37
|
const MessageInput = () => {
|
|
39
38
|
// const apiClient = getApiClient();
|
|
40
|
-
const { role, apiClient } = getChatConfig();
|
|
39
|
+
const { role, apiClient ,apiUrl} = getChatConfig();
|
|
41
40
|
const { socket, sendMessage, userId } = useChatContext();
|
|
42
41
|
const { selectedConversation, setMessages, setLastSentMessage } = useChatUIStore();
|
|
43
42
|
|
|
@@ -315,7 +314,7 @@ const MessageInput = () => {
|
|
|
315
314
|
file: File,
|
|
316
315
|
onProgress?: (progress: number) => void
|
|
317
316
|
): Promise<{ url: string; name: string; size: number; type: FileType }> => {
|
|
318
|
-
const response = await apiClient.post(`${Path.preSignUrl}`, {
|
|
317
|
+
const response = await apiClient.post(`${apiUrl}/${Path.preSignUrl}`, {
|
|
319
318
|
fileName: file.name,
|
|
320
319
|
fileType: file.type,
|
|
321
320
|
conversationId: selectedConversation?._id,
|
|
@@ -28,10 +28,10 @@ export const sendMessage = async (params: {
|
|
|
28
28
|
receiverRole,
|
|
29
29
|
} = params;
|
|
30
30
|
// const apiClient = getApiClient();
|
|
31
|
-
const {apiClient} = getChatConfig();
|
|
31
|
+
const {apiClient,apiUrl} = getChatConfig();
|
|
32
32
|
|
|
33
33
|
const response = await apiClient.post(
|
|
34
|
-
`${Path.sendmessage}/${receiverId}/${senderId}`,
|
|
34
|
+
`${apiUrl}/${Path.sendmessage}/${receiverId}/${senderId}`,
|
|
35
35
|
{
|
|
36
36
|
message,
|
|
37
37
|
attachments,
|
|
@@ -49,9 +49,9 @@ const {apiClient} = getChatConfig();
|
|
|
49
49
|
|
|
50
50
|
|
|
51
51
|
export const fetchMessages = async (chatId: string | undefined, userid: string, pagenum: number) => {
|
|
52
|
-
const {apiClient} = getChatConfig();
|
|
52
|
+
const {apiClient,apiUrl} = getChatConfig();
|
|
53
53
|
try {
|
|
54
|
-
const response = await apiClient.get(`${Path.getmessage}/${chatId}/${userid}`, {
|
|
54
|
+
const response = await apiClient.get(`${apiUrl}/${Path.getmessage}/${chatId}/${userid}`, {
|
|
55
55
|
params: { pagenum, limit: 20 },
|
|
56
56
|
});
|
|
57
57
|
// console.log(response);
|
|
@@ -71,9 +71,9 @@ export const setEditMessage = async ({
|
|
|
71
71
|
userId: string;
|
|
72
72
|
newMessage: string;
|
|
73
73
|
}) => {
|
|
74
|
-
const {apiClient} = getChatConfig();
|
|
74
|
+
const {apiClient,apiUrl} = getChatConfig();
|
|
75
75
|
try {
|
|
76
|
-
const response = await apiClient.put(`${Path.editMessage}/${messageId}`, {
|
|
76
|
+
const response = await apiClient.put(`${apiUrl}/${Path.editMessage}/${messageId}`, {
|
|
77
77
|
userId,
|
|
78
78
|
newMessage
|
|
79
79
|
});
|
|
@@ -92,10 +92,10 @@ export const deleteMessage = async ({
|
|
|
92
92
|
messageId: string;
|
|
93
93
|
userId: string;
|
|
94
94
|
}) => {
|
|
95
|
-
const {apiClient} = getChatConfig();
|
|
95
|
+
const {apiClient,apiUrl} = getChatConfig();
|
|
96
96
|
try {
|
|
97
97
|
const response = await apiClient.delete(
|
|
98
|
-
`${Path.deleteMessage}/${messageId}`,
|
|
98
|
+
`${apiUrl}/${Path.deleteMessage}/${messageId}`,
|
|
99
99
|
{
|
|
100
100
|
data: { userId }
|
|
101
101
|
}
|
|
@@ -6,12 +6,12 @@ import { ApiResponse } from "../types/type";
|
|
|
6
6
|
|
|
7
7
|
export const getAllConversationData = async (userid: string) => {
|
|
8
8
|
try {
|
|
9
|
-
const {role, apiClient} = getChatConfig();
|
|
9
|
+
const {role, apiClient,apiUrl} = getChatConfig();
|
|
10
10
|
// const apiClient = getApiClient();
|
|
11
11
|
|
|
12
12
|
const endpoint = role === 'admin'
|
|
13
|
-
? `${Path.getConversationListByAdmin}`
|
|
14
|
-
: `${Path.getconversation}/${userid}/${role}`;
|
|
13
|
+
? `${apiUrl}/${Path.getConversationListByAdmin}`
|
|
14
|
+
: `${apiUrl}/${Path.getconversation}/${userid}/${role}`;
|
|
15
15
|
|
|
16
16
|
const res = await apiClient.get<ApiResponse>(endpoint);
|
|
17
17
|
if (res.data) {
|