aboutsummaryrefslogtreecommitdiffstats
path: root/code/app/src/utilities/_fetch.ts
diff options
context:
space:
mode:
authoriv-ar <i@oiee.no>2023-03-04 16:54:16 +0100
committeriv-ar <i@oiee.no>2023-03-04 16:54:16 +0100
commitcf546fd4b9a1fbf77bccf5f0b713e688d29a66ad (patch)
tree8103d953afec0618a55dc957ba8a3222dac0e842 /code/app/src/utilities/_fetch.ts
parentb85164718d3bd6a4ad5fc06d04a3ce2dc028b1db (diff)
downloadgreatoffice-cf546fd4b9a1fbf77bccf5f0b713e688d29a66ad.tar.xz
greatoffice-cf546fd4b9a1fbf77bccf5f0b713e688d29a66ad.zip
feat: Use console to log
Diffstat (limited to 'code/app/src/utilities/_fetch.ts')
-rw-r--r--code/app/src/utilities/_fetch.ts22
1 files changed, 11 insertions, 11 deletions
diff --git a/code/app/src/utilities/_fetch.ts b/code/app/src/utilities/_fetch.ts
index 992c7f5..415e1c2 100644
--- a/code/app/src/utilities/_fetch.ts
+++ b/code/app/src/utilities/_fetch.ts
@@ -1,28 +1,28 @@
-import { Temporal } from "temporal-polyfill";
-import { redirect } from "@sveltejs/kit";
-import { browser } from "$app/environment";
-import { goto } from "$app/navigation";
-import { SignInPageMessage, signInPageMessageQueryKey } from "$routes/(main)/(public)/sign-in";
-import { log_error } from "$utilities/logger";
-import { AccountService } from "$services/account-service";
+import {Temporal} from "temporal-polyfill";
+import {redirect} from "@sveltejs/kit";
+import {browser} from "$app/environment";
+import {goto} from "$app/navigation";
+import {SignInPageMessage, signInPageMessageQueryKey} from "$routes/(main)/(public)/sign-in";
+import {AccountService} from "$services/account-service";
+
export async function http_post_async(url: string, body?: object | string, timeout = -1, skip_401_check = false, abort_signal?: AbortSignal): Promise<Response> {
const init = make_request_init("post", body, abort_signal);
- const response = await internal_fetch_async({ url, init, timeout });
+ const response = await internal_fetch_async({url, init, timeout});
if (!skip_401_check && await redirect_if_401_async(response)) throw new Error("Server returned 401");
return response;
}
export async function http_get_async(url: string, timeout = -1, skip_401_check = false, abort_signal?: AbortSignal): Promise<Response> {
const init = make_request_init("get", undefined, abort_signal);
- const response = await internal_fetch_async({ url, init, timeout });
+ const response = await internal_fetch_async({url, init, timeout});
if (!skip_401_check && await redirect_if_401_async(response)) throw new Error("Server returned 401");
return response;
}
export async function http_delete_async(url: string, body?: object | string, timeout = -1, skip_401_check = false, abort_signal?: AbortSignal): Promise<Response> {
const init = make_request_init("delete", body, abort_signal);
- const response = await internal_fetch_async({ url, init, timeout });
+ const response = await internal_fetch_async({url, init, timeout});
if (!skip_401_check && await redirect_if_401_async(response)) throw new Error("Server returned 401");
return response;
}
@@ -42,7 +42,7 @@ async function internal_fetch_async(request: InternalFetchRequest): Promise<Resp
response = await fetch(fetch_request);
}
} catch (error: any) {
- log_error(error);
+ console.error(error);
if (error.message === "Timeout") {
console.error("Request timed out");
} else if (error.message === "Network request failed") {