in src/state/api.js [27:52]
export async function getProbeData(params) {
const data = await fetch(dataURL, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ query: params }),
}).then(async (response) => {
// Catch fetch error responses and show them in the UI.
if (response.status >= 400 && response.status < 600) {
const errorCode = `code${response.status}`;
let msg = FETCH_ERROR_MESSAGES[errorCode] || '';
if (!msg) {
msg =
response.status < 500
? FETCH_ERROR_MESSAGES.code4xx
: FETCH_ERROR_MESSAGES.code5xx;
}
const error = new Error(msg);
error.statusCode = response.status;
throw error;
}
return response.json();
});
return data;
}