mirror of
https://codeberg.org/PLG-Development/PLG-MuDiCS
synced 2026-07-06 00:47:09 +00:00
refactor(control): undo last commit
This commit is contained in:
@@ -209,6 +209,9 @@ async function request(
|
|||||||
): Promise<RequestResponse> {
|
): Promise<RequestResponse> {
|
||||||
try {
|
try {
|
||||||
const cache_buster = `${url.includes('?') ? '&' : '?'}=${Date.now()}`;
|
const cache_buster = `${url.includes('?') ? '&' : '?'}=${Date.now()}`;
|
||||||
|
if (dev) {
|
||||||
|
console.debug('Sending request: ', url + cache_buster, 'with', options.body ?? 'none');
|
||||||
|
}
|
||||||
const response = await fetch(url + cache_buster, options);
|
const response = await fetch(url + cache_buster, options);
|
||||||
if (response.ok || supress_error_handling_http_codes.includes(response.status)) {
|
if (response.ok || supress_error_handling_http_codes.includes(response.status)) {
|
||||||
const contentType = response.headers.get('content-type') || '';
|
const contentType = response.headers.get('content-type') || '';
|
||||||
@@ -219,6 +222,9 @@ async function request(
|
|||||||
} else {
|
} else {
|
||||||
const json: Record<string, unknown> = await response.json();
|
const json: Record<string, unknown> = await response.json();
|
||||||
request_response = { ok: response.ok, http_code: response.status, json: json };
|
request_response = { ok: response.ok, http_code: response.status, json: json };
|
||||||
|
if (dev) {
|
||||||
|
console.debug(request_response);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return request_response;
|
return request_response;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user