@esvndev/es-react-template-chat 0.0.38 → 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 +21 -24
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +21 -23
- 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
|
@@ -8,7 +8,7 @@ require('@styles/base/pages/app-chat.scss');
|
|
|
8
8
|
require('@styles/base/pages/app-chat-list.scss');
|
|
9
9
|
require('react-dom');
|
|
10
10
|
var configureStore = require('@src/redux/configureStore');
|
|
11
|
-
var
|
|
11
|
+
var toolkit = require('@reduxjs/toolkit');
|
|
12
12
|
|
|
13
13
|
function _interopNamespace(e) {
|
|
14
14
|
if (e && e.__esModule) return e;
|
|
@@ -29,7 +29,6 @@ function _interopNamespace(e) {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
32
|
-
var ____toolkit__namespace = /*#__PURE__*/_interopNamespace(____toolkit);
|
|
33
32
|
|
|
34
33
|
var isBlazorPlatform = false;
|
|
35
34
|
/**
|
|
@@ -26296,28 +26295,26 @@ const initialState = {
|
|
|
26296
26295
|
pinnedMessages: [],
|
|
26297
26296
|
typingUsers: {}
|
|
26298
26297
|
};
|
|
26299
|
-
const get_history = (params) => {
|
|
26300
|
-
|
|
26301
|
-
|
|
26302
|
-
|
|
26303
|
-
|
|
26304
|
-
|
|
26305
|
-
|
|
26306
|
-
|
|
26307
|
-
'Content-Type': 'application/json'
|
|
26308
|
-
}
|
|
26309
|
-
});
|
|
26310
|
-
if (!response.ok) {
|
|
26311
|
-
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'
|
|
26312
26306
|
}
|
|
26313
|
-
|
|
26314
|
-
|
|
26315
|
-
|
|
26316
|
-
catch (error) {
|
|
26317
|
-
return thunkAPI.rejectWithValue({ error: error.message });
|
|
26307
|
+
});
|
|
26308
|
+
if (!response.ok) {
|
|
26309
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
26318
26310
|
}
|
|
26319
|
-
|
|
26320
|
-
|
|
26311
|
+
const data = await response.json();
|
|
26312
|
+
return data;
|
|
26313
|
+
}
|
|
26314
|
+
catch (error) {
|
|
26315
|
+
return thunkAPI.rejectWithValue({ error: error.message });
|
|
26316
|
+
}
|
|
26317
|
+
});
|
|
26321
26318
|
// export const get_history = createAsyncThunk<any, any>(CHAT.ACTION_TYPES.GET_HISTORY, async (params, thunkAPI) => {
|
|
26322
26319
|
// try {
|
|
26323
26320
|
// return await api.chatApi.getHistory(params)
|
|
@@ -26494,7 +26491,7 @@ const get_history = (params) => {
|
|
|
26494
26491
|
// return thunkAPI.rejectWithValue({ error: error.response?.data || error.data })
|
|
26495
26492
|
// }
|
|
26496
26493
|
// })
|
|
26497
|
-
const appChatSlice =
|
|
26494
|
+
const appChatSlice = toolkit.createSlice({
|
|
26498
26495
|
name: 'appChat',
|
|
26499
26496
|
initialState,
|
|
26500
26497
|
reducers: {
|
|
@@ -26865,7 +26862,7 @@ const useChat = () => {
|
|
|
26865
26862
|
const dispatch = configureStore.useAppDispatch();
|
|
26866
26863
|
const { active, checkInit, chatRoomId, userLogin, listContact, contactId, typeChat, loadChat, messageByGroup, listHistory, listChatType, archiveStore, checkScroll, listGeneralGroup, pinnedMessages, typingUsers } = configureStore.useAppSelector((state) => state.chat);
|
|
26867
26864
|
const getHistoryApi = (params) => {
|
|
26868
|
-
return dispatch(get_history());
|
|
26865
|
+
return dispatch(get_history(params));
|
|
26869
26866
|
};
|
|
26870
26867
|
// const getHistoryApi = async (params: any) => {
|
|
26871
26868
|
// const queryString = new URLSearchParams(params).toString()
|