diff options
author | kartofen <mladenovnasko0@gmail.com> | 2022-08-26 23:54:17 +0300 |
---|---|---|
committer | kartofen <mladenovnasko0@gmail.com> | 2022-08-26 23:54:17 +0300 |
commit | 8f5278eb443864910dd9c2131c992d71e3af2d20 (patch) | |
tree | d56d805fa010e4b10af7dec0ed359f218e859667 /src/lib/api.ts |
Big bang
Diffstat (limited to 'src/lib/api.ts')
-rw-r--r-- | src/lib/api.ts | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/lib/api.ts b/src/lib/api.ts new file mode 100644 index 0000000..221a7b3 --- /dev/null +++ b/src/lib/api.ts @@ -0,0 +1,14 @@ +const base = 'https://localhost:5001/api' + +export async function api(method: string, resource: string, data?: any) { + console.log("API USED", method, resource, data); + + + return await fetch(`${base}/${method}/${resource}`, { + method, + headers: { + 'content-type': 'application/json' + }, + body: data + }); +} |