Hi, could someone explain to me how to retrieve a linked document in my case?
I have a custom type: "home-page". My "home-page" has 2 slices "carousel" and "available_offers". "available_offers" is linked to another document
Current query:
const graphQuery = `{
home-page {
...home-pageFields
}
}`;
const res = await client.getSingle('home-page', {
lang: appLocale,
graphQuery
});
I get a response but it's missing linked document data. Current response:
{"page":1,"results_per_page":1,"results_size":1,"total_results_size":1,"total_pages":1,"next_page":null,"prev_page":null,"results":[{"id":"YWanmxIAACsA3yX8","uid":"home-page","url":"/","type":"home-page","href":"https://ocb-base-local.cdn.prismic.io/api/v2/documents/search?ref=YXawVhIAACkAZecx&integrationFieldsRef=ocb-base-local%7E5effe007-9cd7-4e66-bbd6-58f1c0c4e47c&q=%5B%5B%3Ad+%3D+at%28document.id%2C+%22YWanmxIAACsA3yX8%22%29+%5D%5D","tags":[],"first_publication_date":"2021-10-13T09:32:15+0000","last_publication_date":"2021-10-25T13:25:42+0000","slugs":["home-page"],"linked_documents":[],"lang":"en-gb","alternate_languages":[],"data":{"slices":[{"slice_type":"carousel","slice_label":null,"version":"sktwi1xtmkfgx8626","variation":"default-slice","primary":{"arrowColor":"primary.main","dotColor":"primary.main"},"items":[{"title":[],"description":[],"textColor":"light.main","background":{"dimensions":{"width":1920,"height":1280},"alt":null,"copyright":null,"url":"https://images.prismic.io/ocb-base-local/2295dffc-65a3-4164-b496-3947db9892c2_meeting-1245776_1920.jpg?auto=compress,format"},"backgroundColor":"dark.main","ctaTextColor":"light.main","ctaBackgroundColor":"primary","ctaTextLink":[],"slideVariation":"full-width","imageFit":"cover"}]},{"slice_type":"available_offers","slice_label":null,"version":"sktwi1xtmkfgx8626","variation":"default-slice","primary":{"offers":{"id":"YXatGBIAACoAZddj","type":"offers","tags":[],"slug":"available-offers","lang":"en-gb","first_publication_date":"2021-10-25T13:11:57+0000","last_publication_date":"2021-10-25T13:11:57+0000","link_type":"Document","isBroken":false}},"items":[{}]}]}}],"version":"31acd9d","license":"All Rights Reserved"}
I imagine my GraphQuery should be something like this:
const graphQuery = `{
home-page {
...home-pageFields
...on available_offers {
non-repeat {
...non-repeatFields
}
repeat {
...repeatFields
}
}
}
}`;
But that doesn't work. Not sure how to achieve this...