forked from DebaucheryLibrarian/traxxx
Changed range filter to routes for every view.
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
import { graphql } from '../api';
|
||||
import { releasesFragment } from '../fragments';
|
||||
import { curateSite } from '../curate';
|
||||
import getDateRange from '../get-date-range';
|
||||
|
||||
function initSitesActions(store, _router) {
|
||||
async function fetchSiteBySlug(siteSlug, limit = 100) {
|
||||
async function fetchSiteBySlug({ _commit }, { siteSlug, limit = 100, range = 'latest' }) {
|
||||
const { before, after, orderBy } = getDateRange(range);
|
||||
|
||||
const { site } = await graphql(`
|
||||
query Site(
|
||||
$siteSlug: String!,
|
||||
@@ -36,21 +39,17 @@ function initSitesActions(store, _router) {
|
||||
`, {
|
||||
siteSlug,
|
||||
limit,
|
||||
after: store.getters.after,
|
||||
before: store.getters.before,
|
||||
after,
|
||||
before,
|
||||
orderBy,
|
||||
isNew: store.getters.isNew,
|
||||
orderBy: store.getters.orderBy,
|
||||
exclude: store.state.ui.filter,
|
||||
});
|
||||
|
||||
return curateSite(site);
|
||||
}
|
||||
|
||||
async function fetchSites({ _commit }, { siteSlug, limit = 100 }) {
|
||||
if (siteSlug) {
|
||||
return fetchSiteBySlug(siteSlug, limit);
|
||||
}
|
||||
|
||||
async function fetchSites({ _commit }, { limit = 100 }) {
|
||||
const { sites } = await graphql(`
|
||||
query Sites(
|
||||
$actorSlug: String!
|
||||
@@ -102,6 +101,7 @@ function initSitesActions(store, _router) {
|
||||
}
|
||||
|
||||
return {
|
||||
fetchSiteBySlug,
|
||||
fetchSites,
|
||||
searchSites,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user