Added public visibility toggle to user page stashes.

This commit is contained in:
DebaucheryLibrarian
2021-03-20 02:03:30 +01:00
parent 011f10fba8
commit 4bc6ff846d
11 changed files with 240 additions and 24 deletions

View File

@@ -25,9 +25,9 @@ async function get(endpoint, query = {}) {
throw new Error(errorMsg);
}
async function post(endpoint, data) {
async function post(endpoint, data, method = 'POST') {
const res = await fetch(`${config.api.url}${endpoint}`, {
method: 'POST',
method,
mode: 'cors',
headers: {
'Content-Type': 'application/json',
@@ -51,6 +51,14 @@ async function post(endpoint, data) {
throw new Error(errorMsg);
}
async function patch(endpoint, data) {
return post(endpoint, data, 'PATCH');
}
async function put(endpoint, data) {
return post(endpoint, data, 'PUT');
}
async function del(endpoint) {
const res = await fetch(`${config.api.url}${endpoint}`, {
method: 'DELETE',
@@ -97,4 +105,6 @@ export {
post,
del,
graphql,
patch,
put,
};