I'm trying to get the set_name from the set schema that is associated to the current slug. *[_type == 'set']{set_name, slug} is how the schema looks. I'm not getting the set_name when I click on the slug however, and my console isn't showing any errors.
const sets = (setData) => {
return (
<div>
<Header />
<main className="slug-gallery">
<div className='title'>
<h2>{setData.set_name}</h2>
</div>
</main>
</div>
}
export default sets;
export const getServerSideProps = async (pageContext) => {
const setSlug = pageContext.query.slug;
const setQuery = `*[_type == 'set' && slug.current == $setSlug][0]`;
const setData = await client.fetch(setQuery, {setSlug})
return {
props: {setData}
}
}