chore: logging for swr fetch

feat/axum
Tomáš Mládek 2023-09-07 18:12:44 +02:00
parent 257044e66d
commit 959a613ea3
1 changed files with 3 additions and 0 deletions

View File

@ -1,4 +1,6 @@
import { writable } from "svelte/store";
import { debug } from "debug";
const dbg = debug("kestrel:swrshim");
// stale shim until https://github.com/ConsoleTVs/sswr/issues/24 is resolved
export type SWRKey = string;
@ -10,6 +12,7 @@ export function useSWR<D = unknown, E = Error>(
const error = writable<E | undefined>();
async function doFetch() {
dbg("Fetching: %s", key);
try {
const response = await fetch(key, options);
if (response.ok) {