@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
package/dist/index.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import '@styles/base/pages/app-chat.scss';
|
|
|
5
5
|
import '@styles/base/pages/app-chat-list.scss';
|
|
6
6
|
import 'react-dom';
|
|
7
7
|
import { useAppDispatch, useAppSelector } from '@src/redux/configureStore';
|
|
8
|
-
import {
|
|
8
|
+
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
9
9
|
|
|
10
10
|
var isBlazorPlatform = false;
|
|
11
11
|
/**
|
|
@@ -26272,28 +26272,26 @@ const initialState = {
|
|
|
26272
26272
|
pinnedMessages: [],
|
|
26273
26273
|
typingUsers: {}
|
|
26274
26274
|
};
|
|
26275
|
-
const get_history = (params) => {
|
|
26276
|
-
|
|
26277
|
-
|
|
26278
|
-
|
|
26279
|
-
|
|
26280
|
-
|
|
26281
|
-
|
|
26282
|
-
|
|
26283
|
-
'Content-Type': 'application/json'
|
|
26284
|
-
}
|
|
26285
|
-
});
|
|
26286
|
-
if (!response.ok) {
|
|
26287
|
-
throw new Error(`HTTP error! status: ${response.status}`);
|
|
26275
|
+
const get_history = createAsyncThunk(CHAT.ACTION_TYPES.GET_HISTORY, async (params, thunkAPI) => {
|
|
26276
|
+
try {
|
|
26277
|
+
const queryString = new URLSearchParams(params).toString();
|
|
26278
|
+
const response = await fetch(`${CHAT.URL_API.GET_HISTORY_API}?${queryString}`, {
|
|
26279
|
+
method: 'GET',
|
|
26280
|
+
headers: {
|
|
26281
|
+
'Authorization': `Bearer ${getToken()}`,
|
|
26282
|
+
'Content-Type': 'application/json'
|
|
26288
26283
|
}
|
|
26289
|
-
|
|
26290
|
-
|
|
26291
|
-
|
|
26292
|
-
catch (error) {
|
|
26293
|
-
return thunkAPI.rejectWithValue({ error: error.message });
|
|
26284
|
+
});
|
|
26285
|
+
if (!response.ok) {
|
|
26286
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
26294
26287
|
}
|
|
26295
|
-
|
|
26296
|
-
|
|
26288
|
+
const data = await response.json();
|
|
26289
|
+
return data;
|
|
26290
|
+
}
|
|
26291
|
+
catch (error) {
|
|
26292
|
+
return thunkAPI.rejectWithValue({ error: error.message });
|
|
26293
|
+
}
|
|
26294
|
+
});
|
|
26297
26295
|
// export const get_history = createAsyncThunk<any, any>(CHAT.ACTION_TYPES.GET_HISTORY, async (params, thunkAPI) => {
|
|
26298
26296
|
// try {
|
|
26299
26297
|
// return await api.chatApi.getHistory(params)
|
|
@@ -26841,7 +26839,7 @@ const useChat = () => {
|
|
|
26841
26839
|
const dispatch = useAppDispatch();
|
|
26842
26840
|
const { active, checkInit, chatRoomId, userLogin, listContact, contactId, typeChat, loadChat, messageByGroup, listHistory, listChatType, archiveStore, checkScroll, listGeneralGroup, pinnedMessages, typingUsers } = useAppSelector((state) => state.chat);
|
|
26843
26841
|
const getHistoryApi = (params) => {
|
|
26844
|
-
return dispatch(get_history());
|
|
26842
|
+
return dispatch(get_history(params));
|
|
26845
26843
|
};
|
|
26846
26844
|
// const getHistoryApi = async (params: any) => {
|
|
26847
26845
|
// const queryString = new URLSearchParams(params).toString()
|