feat: added loginWithCredentials call

This commit is contained in:
Roberto Tonino
2021-05-23 20:34:01 +02:00
parent 856fdbb6b7
commit f659afffd2
3 changed files with 18 additions and 6 deletions

View File

@@ -19,3 +19,15 @@ export function sendToServer(key, data) {
fetch(url.href).catch(console.error)
}
export const postToServer = (endpoint, data) => {
const url = new URL(`${window.location.origin}/api/${endpoint}`)
fetch(url, {
body: JSON.stringify(data),
headers: {
'Content-Type': 'application/json'
},
method: 'POST'
}).catch(console.error)
}