aboutsummaryrefslogtreecommitdiff
path: root/src/lib/api.ts
diff options
context:
space:
mode:
authorkartofen <mladenovnasko0@gmail.com>2022-08-26 23:54:17 +0300
committerkartofen <mladenovnasko0@gmail.com>2022-08-26 23:54:17 +0300
commit8f5278eb443864910dd9c2131c992d71e3af2d20 (patch)
treed56d805fa010e4b10af7dec0ed359f218e859667 /src/lib/api.ts
Big bang
Diffstat (limited to 'src/lib/api.ts')
-rw-r--r--src/lib/api.ts14
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
+ });
+}