@esvndev/es-react-template-chat 0.0.35 → 0.0.37
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/dist/components/store/index.d.ts +1 -1
- package/dist/index.js +21 -19
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -20
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const get_history: any;
|
|
1
|
+
export declare const get_history: (params: any) => any;
|
|
2
2
|
export declare const appChatSlice: any;
|
|
3
3
|
export declare const selectChat: any, selectContact: any, selectType: any, selectActive: any, selectLoadChat: any, selectByGroup: any, addNewMessage: any, setCountUnread: any, deleteMessage: any, recallMessage: any, getNotification: any, removeChatRoom: any, setListChatType: any, setArchive: any, setApproveStatus: any, setHistory: any, editGroupName: any, setScroll: any, updateMemberGroup: any, setMessageByGroup: any, leaveGroup: any, getGeneralGroup: any, setGeneralGroup: any, editGroupAvatar: any, editGroupTag: any, addPinnedMessage: any, userTyping: any;
|
package/dist/index.js
CHANGED
|
@@ -26295,26 +26295,28 @@ const initialState = {
|
|
|
26295
26295
|
pinnedMessages: [],
|
|
26296
26296
|
typingUsers: {}
|
|
26297
26297
|
};
|
|
26298
|
-
const get_history =
|
|
26299
|
-
|
|
26300
|
-
|
|
26301
|
-
|
|
26302
|
-
|
|
26303
|
-
|
|
26304
|
-
|
|
26305
|
-
|
|
26298
|
+
const get_history = (params) => {
|
|
26299
|
+
return toolkit.createAsyncThunk(CHAT.ACTION_TYPES.GET_HISTORY, async (params, thunkAPI) => {
|
|
26300
|
+
try {
|
|
26301
|
+
const queryString = new URLSearchParams(params).toString();
|
|
26302
|
+
const response = await fetch(`${CHAT.URL_API.GET_HISTORY_API}?${queryString}`, {
|
|
26303
|
+
method: 'GET',
|
|
26304
|
+
headers: {
|
|
26305
|
+
'Authorization': `Bearer ${getToken()}`,
|
|
26306
|
+
'Content-Type': 'application/json'
|
|
26307
|
+
}
|
|
26308
|
+
});
|
|
26309
|
+
if (!response.ok) {
|
|
26310
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
26306
26311
|
}
|
|
26307
|
-
|
|
26308
|
-
|
|
26309
|
-
throw new Error(`HTTP error! status: ${response.status}`);
|
|
26312
|
+
const data = await response.json();
|
|
26313
|
+
return data;
|
|
26310
26314
|
}
|
|
26311
|
-
|
|
26312
|
-
|
|
26313
|
-
|
|
26314
|
-
|
|
26315
|
-
|
|
26316
|
-
}
|
|
26317
|
-
});
|
|
26315
|
+
catch (error) {
|
|
26316
|
+
return thunkAPI.rejectWithValue({ error: error.message });
|
|
26317
|
+
}
|
|
26318
|
+
});
|
|
26319
|
+
};
|
|
26318
26320
|
// export const get_history = createAsyncThunk<any, any>(CHAT.ACTION_TYPES.GET_HISTORY, async (params, thunkAPI) => {
|
|
26319
26321
|
// try {
|
|
26320
26322
|
// return await api.chatApi.getHistory(params)
|
|
@@ -26862,7 +26864,7 @@ const useChat = () => {
|
|
|
26862
26864
|
const dispatch = configureStore.useAppDispatch();
|
|
26863
26865
|
const { active, checkInit, chatRoomId, userLogin, listContact, contactId, typeChat, loadChat, messageByGroup, listHistory, listChatType, archiveStore, checkScroll, listGeneralGroup, pinnedMessages, typingUsers } = configureStore.useAppSelector((state) => state.chat);
|
|
26864
26866
|
const getHistoryApi = (params) => {
|
|
26865
|
-
return dispatch(get_history(
|
|
26867
|
+
return dispatch(get_history());
|
|
26866
26868
|
};
|
|
26867
26869
|
// const getHistoryApi = async (params: any) => {
|
|
26868
26870
|
// const queryString = new URLSearchParams(params).toString()
|