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