Hi all!
I want to fetch more than 2 documents based on a tag. See the docs: @prismicio/client Technical Reference - Prismic . It doesn't seem to work. I get a successful response, however without any results (just an empty array).
See my code below.
Note: If I try to use only two Prismic.Predicates.at() it works properly for every tag/type.
Thanks for your help!
export const prismicFetch = (predicates, options) => {
return Prismic.getApi(envConfig.PRISMIC_API_URL, {
accessToken: envConfig.PRISMIC_API_TOKEN
}).then(api => {
return api.query(predicates && predicates.length ? predicates : '', {
lang: envConfig.PRISMIC_LANGUAGE,
pageSize: 200,
...options
});
});
};
export const fetchFeed = () => {
return prismicFetch(
[
Prismic.Predicates.at('document.type', 'generic_content'),
Prismic.Predicates.at('document.tags', ['male']),
Prismic.Predicates.at('document.tags', ['feed-discover'])
]
);
};