forked from DebaucheryLibrarian/traxxx
Added favorites button to actor page.
This commit is contained in:
@@ -1,101 +1,17 @@
|
||||
import { graphql } from '../api';
|
||||
import { curateStash } from '../curate';
|
||||
import { post, del } from '../api';
|
||||
|
||||
function initStashesActions(_store, _router) {
|
||||
async function fetchUserStashes(context, userId) {
|
||||
const { stashes } = await graphql(`
|
||||
query Stashes(
|
||||
$userId: Int!
|
||||
) {
|
||||
stashes(
|
||||
filter: {
|
||||
userId: {
|
||||
equalTo: $userId
|
||||
}
|
||||
}
|
||||
) {
|
||||
id
|
||||
name
|
||||
actors: stashesActors {
|
||||
comment
|
||||
actor {
|
||||
id
|
||||
name
|
||||
slug
|
||||
gender
|
||||
age
|
||||
ageFromBirth
|
||||
dateOfBirth
|
||||
birthCity
|
||||
birthState
|
||||
birthCountry: countryByBirthCountryAlpha2 {
|
||||
alpha2
|
||||
name
|
||||
alias
|
||||
}
|
||||
avatar: avatarMedia {
|
||||
id
|
||||
path
|
||||
thumbnail
|
||||
lazy
|
||||
}
|
||||
}
|
||||
}
|
||||
scenes: stashesScenes {
|
||||
comment
|
||||
scene {
|
||||
id
|
||||
title
|
||||
slug
|
||||
url
|
||||
date
|
||||
actors: releasesActors {
|
||||
actor {
|
||||
id
|
||||
name
|
||||
slug
|
||||
}
|
||||
}
|
||||
tags: releasesTags {
|
||||
tag {
|
||||
id
|
||||
name
|
||||
slug
|
||||
}
|
||||
}
|
||||
entity {
|
||||
id
|
||||
name
|
||||
slug
|
||||
independent
|
||||
parent {
|
||||
id
|
||||
name
|
||||
slug
|
||||
independent
|
||||
}
|
||||
}
|
||||
poster: releasesPosterByReleaseId {
|
||||
media {
|
||||
path
|
||||
thumbnail
|
||||
lazy
|
||||
isS3
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`, {
|
||||
userId,
|
||||
});
|
||||
async function stashActor(context, { actorId, stashId }) {
|
||||
await post(`/stashes/${stashId}/actors`, { actorId });
|
||||
}
|
||||
|
||||
return stashes.map(stash => curateStash(stash));
|
||||
async function unstashActor(context, { actorId, stashId }) {
|
||||
await del(`/stashes/${stashId}/actors/${actorId}`);
|
||||
}
|
||||
|
||||
return {
|
||||
fetchUserStashes,
|
||||
stashActor,
|
||||
unstashActor,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user