@esvndev/es-react-template-chat 0.0.36 → 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.
@@ -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 reduxToolkit_esm_js = require('@reduxjs/toolkit/dist/redux-toolkit.esm.js');
11
+ var toolkit = require('@reduxjs/toolkit');
12
12
 
13
13
  function _interopNamespace(e) {
14
14
  if (e && e.__esModule) return e;
@@ -26295,26 +26295,28 @@ const initialState = {
26295
26295
  pinnedMessages: [],
26296
26296
  typingUsers: {}
26297
26297
  };
26298
- const get_history = reduxToolkit_esm_js.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'
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
- if (!response.ok) {
26309
- throw new Error(`HTTP error! status: ${response.status}`);
26312
+ const data = await response.json();
26313
+ return data;
26310
26314
  }
26311
- const data = await response.json();
26312
- return data;
26313
- }
26314
- catch (error) {
26315
- return thunkAPI.rejectWithValue({ error: error.message });
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)
@@ -26491,7 +26493,7 @@ const get_history = reduxToolkit_esm_js.createAsyncThunk(CHAT.ACTION_TYPES.GET_H
26491
26493
  // return thunkAPI.rejectWithValue({ error: error.response?.data || error.data })
26492
26494
  // }
26493
26495
  // })
26494
- const appChatSlice = reduxToolkit_esm_js.createSlice({
26496
+ const appChatSlice = toolkit.createSlice({
26495
26497
  name: 'appChat',
26496
26498
  initialState,
26497
26499
  reducers: {
@@ -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(params));
26867
+ return dispatch(get_history());
26866
26868
  };
26867
26869
  // const getHistoryApi = async (params: any) => {
26868
26870
  // const queryString = new URLSearchParams(params).toString()