Full refactor to Typescript

This commit is contained in:
2022-11-17 19:19:33 +01:00
parent de3f10b3ee
commit ffd3c99292
19 changed files with 180 additions and 95 deletions
+18
View File
@@ -0,0 +1,18 @@
export const server = {
async get(url: string) {
const res = await fetch(url, { credentials: 'include' })
return await res.json()
},
async post<T>(url: string, body?: T) {
const res = await fetch(url, {
method: 'POST',
credentials: 'include',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(body),
})
return await res.json()
},
}