Basically library structure

This commit is contained in:
mrjvs
2023-08-23 20:07:39 +02:00
parent fe721bee37
commit ef766936dd
12 changed files with 191 additions and 29 deletions

View File

@@ -0,0 +1,15 @@
import { makeFullUrl } from '@/fetchers/common';
import { Fetcher } from '@/fetchers/types';
export function makeStandardFetcher(f: typeof fetch): Fetcher {
const normalFetch: Fetcher = (url, ops) => {
const fullUrl = makeFullUrl(url, ops);
return f(fullUrl, {
method: ops.method,
body: JSON.stringify(ops.body), // TODO content type headers + proper serialization
});
};
return normalFetch;
}