Refactoring client to reflect database changes.

This commit is contained in:
2019-12-19 04:42:50 +01:00
parent 31aee71edb
commit 1c43884102
9 changed files with 114 additions and 78 deletions

View File

@@ -5,18 +5,7 @@ import {
releaseTagsFragment,
siteFragment,
} from '../fragments';
import { curateRelease } from '../curate';
function curateTag(tag) {
const curatedTag = {
...tag,
};
if (tag.releases) curatedTag.releases = tag.releases.map(({ tagRelease }) => curateRelease(tagRelease));
if (tag.poster) [curatedTag.poster] = tag.poster;
return curatedTag;
}
import { curateTag } from '../curate';
function initTagsActions(store, _router) {
async function fetchTagBySlug(tagSlug) {
@@ -31,20 +20,24 @@ function initTagsActions(store, _router) {
name
slug
}
poster: tagsMediasByTargetId(condition: { role: "poster" }) {
id
thumbnail
path
comment
poster: tagsPosterByTagId {
media {
id
thumbnail
path
comment
}
}
photos: tagsMediasByTargetId(condition: { role: "photo" }) {
id
thumbnail
path
comment
photos: tagsPhotos {
media {
id
thumbnail
path
comment
}
}
releases: releasesTags {
tagRelease {
release {
id
title
date
@@ -82,8 +75,10 @@ function initTagsActions(store, _router) {
id
name
slug
poster: tagsMediasByTargetId(condition: { role: "poster" }) {
thumbnail
poster: tagsPosterByTagId {
media {
thumbnail
}
}
group {
name