Changed range toggles to links for home and actor pages.

This commit is contained in:
2020-05-07 03:20:51 +02:00
parent 2b2fb9e3e7
commit 525995615a
10 changed files with 116 additions and 104 deletions

View File

@@ -5,6 +5,7 @@ import {
releaseTagsFragment,
} from '../fragments';
import { curateRelease } from '../curate';
import getDateRange from '../get-date-range';
function curateActor(actor) {
const curatedActor = {
@@ -45,7 +46,9 @@ function curateActor(actor) {
}
function initActorActions(store, _router) {
async function fetchActorBySlug(actorSlug, limit = 100) {
async function fetchActorBySlug({ _commit }, { slug, limit = 100, range = 'latest' }) {
const { before, after, orderBy } = getDateRange(range);
const { actor } = await graphql(`
query Actor(
$actorSlug: String!
@@ -168,11 +171,11 @@ function initActorActions(store, _router) {
}
}
`, {
actorSlug,
actorSlug: slug,
limit,
after: store.getters.after,
before: store.getters.before,
orderBy: store.getters.orderBy === 'DATE_DESC' ? 'RELEASE_BY_RELEASE_ID__DATE_DESC' : 'RELEASE_BY_RELEASE_ID__DATE_ASC',
after,
before,
orderBy: orderBy === 'DATE_DESC' ? 'RELEASE_BY_RELEASE_ID__DATE_DESC' : 'RELEASE_BY_RELEASE_ID__DATE_ASC',
exclude: store.state.ui.filter,
});
@@ -180,15 +183,10 @@ function initActorActions(store, _router) {
}
async function fetchActors({ _commit }, {
actorSlug,
limit = 100,
letter,
genders,
}) {
if (actorSlug) {
return fetchActorBySlug(actorSlug);
}
const { actors } = await graphql(`
query Actors(
$limit: Int,
@@ -260,6 +258,7 @@ function initActorActions(store, _router) {
}
return {
fetchActorBySlug,
fetchActors,
fetchActorReleases,
};