You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
463 B
JavaScript

export const server = {
async get(url) {
const res = await fetch(url, { credentials: 'include' })
return await res.json()
},
async post(url, body) {
const res = await fetch(url, {
method: 'POST',
credentials: 'include',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(body),
})
return await res.json()
},
}