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