@esvndev/es-react-template-chat 0.0.24 → 0.0.26

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
@@ -26242,23 +26242,38 @@ const encodeUUID = (uuid) => {
26242
26242
  }
26243
26243
  };
26244
26244
 
26245
+ const getToken = () => {
26246
+ let accessToken = localStorage.getItem('access_token');
26247
+ if (!accessToken) {
26248
+ const userData = localStorage.getItem('userData');
26249
+ if (userData && userData.length) {
26250
+ accessToken = JSON.parse(userData).id_token;
26251
+ }
26252
+ }
26253
+ return accessToken;
26254
+ };
26255
+
26245
26256
  // import requester from '../requester'
26246
- // import { AxiosRequestConfig } from 'axios'
26247
- // import { getToken } from '../auth'
26248
- // import { CHAT } from '../../domain/constants'
26249
- // const { URL_API } = CHAT
26250
- // const config: AxiosRequestConfig = {
26251
- // headers: {
26252
- // Authorization: `Bearer ${getToken()}`
26253
- // }
26254
- // }
26257
+ const { URL_API } = CHAT;
26258
+ ({
26259
+ headers: {
26260
+ Authorization: `Bearer ${getToken()}`
26261
+ }
26262
+ });
26255
26263
  const chatApi = {
26256
- //getHistoryActive: (params: any) => requester.get(URL_API.GET_HISTORY_API, params, config),
26257
- //getHistory: (params: any) => requester.get(URL_API.GET_HISTORY_API, params, config),
26258
26264
  getHistory: (params) => {
26259
- console.log('getHistory params', params);
26260
- return 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)
26261
26270
  }
26271
+ //getHistoryActive: (params: any) => requester.get(URL_API.GET_HISTORY_API, params, config),
26272
+ //getHistory: (params: any) => requester.get(URL_API.GET_HISTORY_API, params, config)
26273
+ // getHistory: (params: any) => {
26274
+ // console.log('getHistory params', params)
26275
+ // return params
26276
+ // }
26262
26277
  // getMessageByGroupCursor: (id:string, params: any) => requester.get(`${URL_API.GET_MESSAGE_BY_GROUP_CURSOR_API}/${id}`, params, config),
26263
26278
  // getInfo: (params: any) => requester.get(URL_API.GET_INFO_API, params, config),
26264
26279
  // groups: (params: any) => requester.post(URL_API.GROUP_API, params, config),