pb-sxp-ui 1.15.20-alpha.3 → 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.cjs CHANGED
@@ -743,18 +743,12 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
743
743
  const queryString = qs.stringify(options.query);
744
744
  path = `${path}?${queryString}`;
745
745
  }
746
- // 事件上报优化
747
- // Beacon API 用于发送异步和非阻塞请求到服务器。这类请求不需要响应。
748
- if (options.type === 'beacon' && navigator.sendBeacon) {
749
- const formData = new FormData();
750
- formData.append('data', JSON.stringify(Object.assign(Object.assign(Object.assign({}, options.body), bffDataSource.headers), { 'x-user-id': fakeUserId })));
751
- return navigator.sendBeacon(`${url}/api/${path}`, formData);
752
- }
753
746
  return window
754
747
  .fetch(`${url}/api/${path}`, {
755
748
  headers: Object.assign({ 'Content-Type': 'application/json', 'x-user-id': fakeUserId }, bffDataSource.headers),
756
749
  method: options.method,
757
- body: JSON.stringify(options.body)
750
+ body: JSON.stringify(options.body),
751
+ keepalive: true
758
752
  })
759
753
  .then((res) => res.json())
760
754
  .catch((err) => Promise.reject(err));