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