@pubuduth-aplicy/chat-ui 2.0.8 → 2.0.9
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 +1 -1
- package/src/service/sidebarApi.ts +8 -1
- package/src/types/type.ts +11 -1
package/package.json
CHANGED
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
2
|
import { apiClient } from "../lib/api/apiClient";
|
|
3
3
|
import { Path } from "../lib/api/endpoint";
|
|
4
|
+
import { ApiResponse, Conversation } from "../types/type";
|
|
4
5
|
|
|
5
6
|
|
|
6
7
|
export const getAllConversationData = async (userid: string) => {
|
|
7
8
|
try {
|
|
8
9
|
const res = await apiClient.get(`${Path.getconversation}/${userid}`);
|
|
9
|
-
|
|
10
|
+
|
|
11
|
+
const formattedConversations = (res.data as ApiResponse['data']).map((conversation: Conversation) => ({
|
|
12
|
+
_id: conversation._id,
|
|
13
|
+
participantDetails: conversation.participantDetails
|
|
14
|
+
}));
|
|
15
|
+
const allParticipantDetails = formattedConversations.flatMap(conversation => conversation.participantDetails);
|
|
16
|
+
return allParticipantDetails;
|
|
10
17
|
} catch (error: any) {
|
|
11
18
|
console.log("ERROR: ", error);
|
|
12
19
|
// logger.error(error);
|
package/src/types/type.ts
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
1
2
|
export interface ChatWindowProps {
|
|
2
3
|
userId: string;
|
|
3
|
-
}
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export interface Conversation {
|
|
7
|
+
_id: string;
|
|
8
|
+
participantDetails: any; // Replace 'any' with a more specific type if available
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface ApiResponse {
|
|
12
|
+
data: Conversation[];
|
|
13
|
+
}
|