@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.mjs CHANGED
@@ -26219,23 +26219,38 @@ const encodeUUID = (uuid) => {
26219
26219
  }
26220
26220
  };
26221
26221
 
26222
+ const getToken = () => {
26223
+ let accessToken = localStorage.getItem('access_token');
26224
+ if (!accessToken) {
26225
+ const userData = localStorage.getItem('userData');
26226
+ if (userData && userData.length) {
26227
+ accessToken = JSON.parse(userData).id_token;
26228
+ }
26229
+ }
26230
+ return accessToken;
26231
+ };
26232
+
26222
26233
  // import requester from '../requester'
26223
- // import { AxiosRequestConfig } from 'axios'
26224
- // import { getToken } from '../auth'
26225
- // import { CHAT } from '../../domain/constants'
26226
- // const { URL_API } = CHAT
26227
- // const config: AxiosRequestConfig = {
26228
- // headers: {
26229
- // Authorization: `Bearer ${getToken()}`
26230
- // }
26231
- // }
26234
+ const { URL_API } = CHAT;
26235
+ ({
26236
+ headers: {
26237
+ Authorization: `Bearer ${getToken()}`
26238
+ }
26239
+ });
26232
26240
  const chatApi = {
26233
- //getHistoryActive: (params: any) => requester.get(URL_API.GET_HISTORY_API, params, config),
26234
- //getHistory: (params: any) => requester.get(URL_API.GET_HISTORY_API, params, config),
26235
26241
  getHistory: (params) => {
26236
- console.log('getHistory params', params);
26237
- return params;
26242
+ console.log('Token:', getToken());
26243
+ console.log('Params:', params);
26244
+ console.log('URL:', URL_API.GET_HISTORY_API);
26245
+ return 'vv';
26246
+ //return requester.get(URL_API.GET_HISTORY_API, params, config)
26238
26247
  }
26248
+ //getHistoryActive: (params: any) => requester.get(URL_API.GET_HISTORY_API, params, config),
26249
+ //getHistory: (params: any) => requester.get(URL_API.GET_HISTORY_API, params, config)
26250
+ // getHistory: (params: any) => {
26251
+ // console.log('getHistory params', params)
26252
+ // return params
26253
+ // }
26239
26254
  // getMessageByGroupCursor: (id:string, params: any) => requester.get(`${URL_API.GET_MESSAGE_BY_GROUP_CURSOR_API}/${id}`, params, config),
26240
26255
  // getInfo: (params: any) => requester.get(URL_API.GET_INFO_API, params, config),
26241
26256
  // groups: (params: any) => requester.post(URL_API.GROUP_API, params, config),