| @@ -1,7 +1,8 @@ | ||
| 1 | 1 | import { useLaunchDataStore } from '@auto-launch/state/launch-data'; |
| 2 | 2 | import { INSIGHTS_HOST } from '@constants'; |
| 3 | 3 | import { reqDataBasics } from '@shared/lib/data'; |
| 4 | +import { track } from '@shared/lib/track'; | |
| 4 | 5 | import apiFetch from '@wordpress/api-fetch'; |
| 5 | 6 | |
| 6 | 7 | const headers = { |
| 7 | 8 | 'Content-type': 'application/json', |
| @@ -87,19 +88,6 @@ | ||
| 87 | 88 | |
| 88 | 89 | export const reportRestApiStatus = async () => { |
| 89 | 90 | const reason = await probeFailureReason(); |
| 90 | 91 | if (!reason) return; |
| 91 | - const { siteId, partnerId, homeUrl, siteCreatedAt } = reqDataBasics; | |
| 92 | - return fetch(`${INSIGHTS_HOST}/api/v1/event`, { | |
| 93 | - method: 'POST', | |
| 94 | - headers, | |
| 95 | - body: JSON.stringify({ | |
| 96 | - insightsId: siteId, | |
| 97 | - key: 'rest_api_unreachable', | |
| 98 | - payload: { reason }, | |
| 99 | - partnerId, | |
| 100 | - siteURL: homeUrl, | |
| 101 | - siteCreatedAt, | |
| 102 | - }), | |
| 103 | - keepalive: true, | |
| 104 | - }); | |
| 92 | + track('rest_api_unreachable', { reason }); | |
| 105 | 93 | }; |