Added user sign up and login.

This commit is contained in:
DebaucheryLibrarian
2021-03-13 04:26:24 +01:00
parent 99cfd3dc3f
commit 816529b0ca
42 changed files with 741 additions and 8 deletions

View File

@@ -39,6 +39,22 @@ async function post(endpoint, data) {
throw new Error(errorMsg);
}
async function del(endpoint) {
const res = await fetch(`${config.api.url}${endpoint}`, {
method: 'DELETE',
mode: 'cors',
credentials: 'same-origin',
});
if (res.ok) {
return true;
}
const errorMsg = await res.text();
throw new Error(errorMsg);
}
async function graphql(query, variables = null) {
const res = await fetch('/graphql', {
method: 'POST',
@@ -67,5 +83,6 @@ async function graphql(query, variables = null) {
export {
get,
post,
del,
graphql,
};