MCPcopy Create free account
hub / github.com/Rello/analytics / request

Function request

js/jsonPicker.js:73–86  ·  view source on GitHub ↗
(url, payload, signal)

Source from the content-addressed store, hash-verified

71 status.textContent = '';
72 };
73 const request = async (url, payload, signal) => {
74 const response = await fetch(OC.generateUrl(url), {
75 method: 'POST', headers: OCA.Analytics.headers(), signal,
76 body: JSON.stringify(payload)
77 });
78 let result;
79 try { result = await response.json(); }
80 // TRANSLATORS: {status} is an HTTP response status code, e.g. 404.
81 catch (error) { throw new Error(t('analytics', 'The datasource request failed (HTTP {status}).', {status: response.status})); }
82 if (!response.ok || (result.error && String(result.error) !== '0')) {
83 throw new Error(result.error || t('analytics', 'Could not load JSON data. Check the datasource settings.'));
84 }
85 return result;
86 };
87 previewButton.addEventListener('click', async () => {
88 previewController?.abort();
89 previewController = new AbortController();

Callers 1

jsonPicker.jsFile · 0.70

Calls 1

tFunction · 0.50

Tested by

no test coverage detected