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