Entity refactor. Facilitating channels without parent.
This commit is contained in:
@@ -57,6 +57,7 @@ function initEntitiesActions(store, _router) {
|
||||
filter: {
|
||||
entity: {
|
||||
or: [
|
||||
{ slug: { equalTo: $entitySlug } },
|
||||
{ parent: { slug: { equalTo: $entitySlug } } },
|
||||
{ parent: { parent: { slug: { equalTo: $entitySlug } } } }
|
||||
]
|
||||
@@ -114,17 +115,27 @@ function initEntitiesActions(store, _router) {
|
||||
};
|
||||
}
|
||||
|
||||
async function fetchEntities({ _commit }, { type }) {
|
||||
async function fetchEntities({ _commit }, { type, entitySlugs }) {
|
||||
const { entities } = await graphql(`
|
||||
query Entities(
|
||||
$type: String! = "network"
|
||||
$entitySlugs: [String!] = []
|
||||
) {
|
||||
entities(
|
||||
orderBy: NAME_ASC
|
||||
filter: {
|
||||
type: {
|
||||
equalTo: $type
|
||||
}
|
||||
or: [
|
||||
{
|
||||
type: {
|
||||
equalTo: $type
|
||||
}
|
||||
}
|
||||
{
|
||||
slug: {
|
||||
in: $entitySlugs
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
) {
|
||||
id
|
||||
@@ -134,7 +145,10 @@ function initEntitiesActions(store, _router) {
|
||||
url
|
||||
}
|
||||
}
|
||||
`, { type });
|
||||
`, {
|
||||
type,
|
||||
entitySlugs,
|
||||
});
|
||||
|
||||
return entities.map(entity => curateEntity(entity));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user