Added user sign up and login.
This commit is contained in:
@@ -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,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user