Changed range filter to routes for every view.

This commit is contained in:
2020-05-09 01:10:07 +02:00
parent 525995615a
commit de5b729c0b
16 changed files with 125 additions and 73 deletions

View File

@@ -3,9 +3,12 @@ import {
releaseFields,
} from '../fragments';
import { curateTag } from '../curate';
import getDateRange from '../get-date-range';
function initTagsActions(store, _router) {
async function fetchTagBySlug(tagSlug, limit = 100) {
async function fetchTagBySlug({ _commit }, { tagSlug, limit = 100, range = 'latest' }) {
const { before, after, orderBy } = getDateRange(range);
const { tagBySlug } = await graphql(`
query Tag(
$tagSlug:String!
@@ -84,9 +87,9 @@ function initTagsActions(store, _router) {
`, {
tagSlug,
limit,
after: store.getters.after,
before: store.getters.before,
orderBy: store.getters.isNew,
after,
before,
orderBy: orderBy === 'DATE_DESC' ? 'RELEASE_BY_RELEASE_ID__DATE_DESC' : 'RELEASE_BY_RELEASE_ID__DATE_ASC',
exclude: store.state.ui.filter,
});
@@ -94,16 +97,11 @@ function initTagsActions(store, _router) {
}
async function fetchTags({ _commit }, {
tagSlug,
limit = 100,
slugs = [],
_group,
_priority,
}) {
if (tagSlug) {
return fetchTagBySlug(tagSlug);
}
const { tags } = await graphql(`
query Tags(
$slugs: [String!] = [],
@@ -153,9 +151,9 @@ function initTagsActions(store, _router) {
}
return {
fetchTagBySlug,
fetchTags,
fetchTagReleases,
fetchTagBySlug,
};
}