Hi,
I have the following prismic model for ads document;
{
"Main" : {
"name" : {
"type" : "Text",
"config" : {
"label" : "name"
}
},
"url" : {
"type" : "Text",
"config" : {
"label" : "url",
"placeholder" : "Promotion's url"
}
},
"images" : {
"type" : "Image",
"config" : {
"constraint" : {
"width" : 328,
"height" : 328
},
"thumbnails" : [ {
"name" : "portrait",
"width" : 328,
"height" : 656
}, {
"name" : "landscape",
"width" : 656,
"height" : 328
} ],
"label" : "images"
}
},
"body" : {
"type" : "Slices",
"fieldset" : "Slice zone",
"config" : {
"labels" : null,
"choices" : {
"adsimagesquare" : {
"type" : "Slice",
"fieldset" : "AdsImageSquare",
"description" : "Ads Image Square 1:1",
"icon" : "image",
"display" : "list",
"repeat" : { },
"non-repeat" : {
"image" : {
"type" : "Image",
"config" : {
"constraint" : {
"width" : 328,
"height" : 328
},
"thumbnails" : [ {
"name" : "square",
"width" : 328,
"height" : 328
} ]
}
}
}
},
"adsimageportrait" : {
"type" : "Slice",
"fieldset" : "AdsImagePortrait",
"description" : "Ads Image Portrait 1:2",
"icon" : "image",
"display" : "list",
"repeat" : { },
"non-repeat" : {
"image" : {
"type" : "Image",
"config" : {
"constraint" : {
"width" : 328,
"height" : 656
},
"thumbnails" : [ {
"name" : "square",
"width" : 328,
"height" : 656
} ]
}
}
}
},
"adsimagelandscape" : {
"type" : "Slice",
"fieldset" : "AdsImageLandscape",
"description" : "Ads Image Landscape 2:1",
"icon" : "image",
"display" : "list",
"repeat" : { },
"non-repeat" : {
"image" : {
"type" : "Image",
"config" : {
"constraint" : {
"width" : 656,
"height" : 328
},
"thumbnails" : [ {
"name" : "landscape",
"width" : 656,
"height" : 328
} ]
}
}
}
}
}
}
}
}
}
And currently, I would need to grab all ads documents, that has adsimagesquare
in its body.
This is my current attempt at the moment;
useEffect(() => {
const queries = [
Prismic.predicates.at("document.type", "ads"),
Prismic.predicates.has("my.ads.adsimagesquare")
];
const options = {
lang: "en-us",
fetchLinks: [
],
};
prismicClientHttp
.query(queries, options)
.then((doc: any) => {
return doc;
})
.catch((err) => {
console.error(err);
return null;
});
}, []);
However, I am not having any luck here. I also am failing to find the related documents or QnAs regarding the same scenario
Please kindly help, any suggestion is appreciated.