@esvndev/es-react-template-chat 0.0.27 → 0.0.29

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/index.js CHANGED
@@ -26255,18 +26255,18 @@ const getToken = () => {
26255
26255
 
26256
26256
  // import requester from '../requester'
26257
26257
  const { URL_API } = CHAT;
26258
- ({
26259
- headers: {
26260
- Authorization: `Bearer ${getToken()}`
26261
- }
26262
- });
26263
26258
  const chatApi = {
26264
- getHistory: (params) => {
26265
- console.log('Token:', getToken());
26266
- console.log('Params:', params);
26267
- console.log('URL:', URL_API.GET_HISTORY_API);
26268
- return 'vv';
26269
- //return requester.get(URL_API.GET_HISTORY_API, params, config)
26259
+ getHistory: async (params) => {
26260
+ const queryString = new URLSearchParams(params).toString();
26261
+ const response = await fetch(`${URL_API.GET_HISTORY_API}?${queryString}`, {
26262
+ headers: {
26263
+ 'Authorization': `Bearer ${getToken()}`,
26264
+ 'Content-Type': 'application/json'
26265
+ }
26266
+ });
26267
+ if (!response.ok)
26268
+ throw new Error(`Error: ${response.status}`);
26269
+ return response.json();
26270
26270
  }
26271
26271
  //getHistoryActive: (params: any) => requester.get(URL_API.GET_HISTORY_API, params, config),
26272
26272
  //getHistory: (params: any) => requester.get(URL_API.GET_HISTORY_API, params, config)