Initial discovery page

This commit is contained in:
Aleksi Lassila
2023-06-20 17:39:39 +03:00
parent acefd62781
commit 4cc2b9c399
26 changed files with 491 additions and 63 deletions

View File

@@ -23,10 +23,10 @@ export function formatSize(size: number) {
}
}
export function request<T, A>(fetcher: (arg: A) => Promise<T>, args: A | undefined = undefined) {
export function request<R, A>(fetcher: (arg: A) => Promise<R>, args: A | undefined = undefined) {
const loading = writable(args !== undefined);
const error = writable<Error | null>(null);
const data = writable<T | null>(null);
const data = writable<R | null>(null);
const didLoad = writable(false);
async function load(arg: A) {
@@ -45,7 +45,7 @@ export function request<T, A>(fetcher: (arg: A) => Promise<T>, args: A | undefin
});
}
if (args) {
if (args !== undefined) {
load(args);
}