I have the following query:
const home = await client.getSingle("homepage", {
graphQuery: `
{
homepage {
...homepageFields
slices {
...on boxes {
variation {
...on default {
primary {
...primaryFields
}
}
}
}
}
}
}
`,
});
const boxes = home.data.slices.find((slice) => slice.slice_type === "boxes");
console.log("boxes", boxes?.primary.items[0]);
This is the output that i get when running the above:
[next] boxes {
[next] title: 'Drept Societar și Comercial',
[next] description: 'Oferim consultanță companiilor în fiecare etapă a evoluției lor. Indiferent dacă ajutăm firme să pătrundă pe piața românească sau să se adapteze specificului juridic local, avem o înțelegere profundă a pieței și contextului de afaceri din România.',
[next] icon: 'gavel',
[next] page: {
[next] id: 'ZyP6GxEAAC4AOKt6',
[next] type: 'page',
[next] tags: [],
[next] lang: 'ro-ro',
[next] slug: 'drept-societar-si-comercial',
[next] first_publication_date: '2024-10-31T21:43:57+0000',
[next] last_publication_date: '2024-10-31T21:45:33+0000',
[next] uid: 'drept-societar-si-comercial',
[next] url: '/drept-societar-si-comercial',
[next] link_type: 'Document',
[next] isBroken: false
[next] }
[next] }
And here is the issue: I want to get additional data of the linked page. For example title and slices.
So what I tried was the following:
homepage {
...homepageFields
slices {
...on boxes {
variation {
...on default {
primary {
page {
...pageFields
}
}
}
}
}
}
}
}
But I get an error:
[next] Unable to find page in primary
[next] at async Index (page.tsx:50:18)
I tried every possible combination, I give up, I don't have a clue how to set this query up :(