I'm using nextjs/Sanity. Want to get all of the image types out of an array, but nothing is showing up and nothing is coming up in the console either. It's particularly everything within the current slug. Not sure if I have imagesQuery
coded right.
export const getServerSideProps = async (pageContext) => {
const setSlug = pageContext.query.slug;
const setQuery = `*[_type == 'set' && slug.current == $setSlug][0]`;
const imagesQuery = `*[_type == 'set' && slug.current == $setSlug][0]{image{
asset->{_id, url}, alt, name, date, size, materials}}}`;
const setData = await client.fetch(setQuery, {setSlug});
const imagesData = await client.fetch(imagesQuery, {setSlug});
return {
props: {setData, imagesData}
}
}
Edit: Okay I made a console log check, it is seeing that an array should appear, and has the correct amount of images, but it says each image is null.