forked from DebaucheryLibrarian/traxxx
Added public visibility toggle to user page stashes.
This commit is contained in:
@@ -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,
|
||||
};
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
import { graphql, post, del } from '../api';
|
||||
import {
|
||||
graphql,
|
||||
post,
|
||||
del,
|
||||
patch,
|
||||
} from '../api';
|
||||
|
||||
import { releaseFields } from '../fragments';
|
||||
import { curateStash } from '../curate';
|
||||
|
||||
@@ -61,6 +67,12 @@ function initStashesActions(store, _router) {
|
||||
return curateStash(stash);
|
||||
}
|
||||
|
||||
async function updateStash(context, { stashId, stash }) {
|
||||
const newStash = await patch(`/stashes/${stashId}`, stash);
|
||||
|
||||
return newStash;
|
||||
}
|
||||
|
||||
async function stashActor(context, { actorId, stashId }) {
|
||||
await post(`/stashes/${stashId}/actors`, { actorId });
|
||||
}
|
||||
@@ -93,6 +105,7 @@ function initStashesActions(store, _router) {
|
||||
unstashActor,
|
||||
unstashScene,
|
||||
unstashMovie,
|
||||
updateStash,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user