pb-sxp-ui 1.15.20-alpha.4 → 1.15.20-alpha.5

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
@@ -721,18 +721,12 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
721
721
  const queryString = qs.stringify(options.query);
722
722
  path = `${path}?${queryString}`;
723
723
  }
724
- // 事件上报优化
725
- // Beacon API 用于发送异步和非阻塞请求到服务器。这类请求不需要响应。
726
- if (options.type === 'beacon' && navigator.sendBeacon) {
727
- return navigator.sendBeacon(`${url}/api/${path}`, new Blob([JSON.stringify(Object.assign(Object.assign(Object.assign({}, options.body), bffDataSource.headers), { 'x-user-id': fakeUserId }))], {
728
- type: 'text/plain'
729
- }));
730
- }
731
724
  return window
732
725
  .fetch(`${url}/api/${path}`, {
733
726
  headers: Object.assign({ 'Content-Type': 'application/json', 'x-user-id': fakeUserId }, bffDataSource.headers),
734
727
  method: options.method,
735
- body: JSON.stringify(options.body)
728
+ body: JSON.stringify(options.body),
729
+ keepalive: true
736
730
  })
737
731
  .then((res) => res.json())
738
732
  .catch((err) => Promise.reject(err));