# Fetch data from content relationship in slices

**URL:** <https://community.prismic.io/t/fetch-data-from-content-relationship-in-slices/15825>\
**Category:** Developing with Prismic\
**Tags:** nuxtjs, fetch-linked-content\
**Created:** [April 30, 2024, 4:16pm UTC](https://community.prismic.io/t/fetch-data-from-content-relationship-in-slices/15825 "2024-04-30T16:16:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sho25052007](https://avatars.discourse-cdn.com/v4/letter/s/71e660/32.png) [@sho25052007](https://community.prismic.io/u/sho25052007)\
**Post date:** [April 30, 2024, 4:16pm UTC](https://community.prismic.io/t/fetch-data-from-content-relationship-in-slices/15825/1 "2024-04-30T16:16:19Z")

</div>

ive followed this tutorial: [mega menu prismic](https://prismic.io/blog/model-mega-menu-prismic#how-our-toplevel-menu-model-translates-to-the-page-builder) using nuxtjs

i've set up a "menu" custom type with a slice "MenuItem" with the variation "WithSubMenu" and this links to a sub menu called "Footer Sub Menu"

 ![SM](https://europe1.discourse-cdn.com/flex013/uploads/prismic/original/2X/7/7bab1f114bc99bb1f4d5439ab79ea0656e5756c4.jpeg)

I get a document returned when i fetch data like this:

```const

const { data: footerSubMenu } = await useAsyncData("footer", async () => {
	const document = client.getByUID("menu", "menus", {
		fetchLinks: "sub_menu.footer_submenu",
	});

	if (document) {
		console.log(document);
		return document;
	} else {
		throw createError({ statusCode: 404, message: "Page not found" });
	}
});

```

but i dont think im using the fetchLinks correctly, or perhaps im supposed to be using GraphQuery??

 ![console](https://europe1.discourse-cdn.com/flex013/uploads/prismic/original/2X/5/5218f384bc587f2d9e8df7774c13feb9445d6fb2.jpeg)

Im a bit lost as to how to pull the data from the content relationship.  
Any help will be appreciated! Thanks in advance.

---

<div class="post-metadata">

**Author:** ![Phil](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/phil/32/14_2.png) [@Phil](https://community.prismic.io/u/Phil)\
**Post date:** [May 2, 2024, 11:46am UTC](https://community.prismic.io/t/fetch-data-from-content-relationship-in-slices/15825/2 "2024-05-02T11:46:13Z")

</div>

Hi @sho25052007 ,

Welcome to the community 🙂

You're correct that you'll need to use GraphQuery to do this because you're getting Slice data from within a Slice, which fetchlinks doesn't do:

> **[GraphQuery](https://prismic.io/docs/graphquery-rest-api)**
>
> This shows how to use the Prismic GraphQuery query option to retrieve certain fields and retrieve content from linked documents.

Pro-tip though: Ask chatgpt for help with this because it can be tricky, just let it know you're custom type structure and make sure you specify that it's Prismic GraphQuery and not GraphQL.

Thanks.

---

<div class="post-metadata">

**Author:** ![sho25052007](https://avatars.discourse-cdn.com/v4/letter/s/71e660/32.png) [@sho25052007](https://community.prismic.io/u/sho25052007)\
**Post date:** [May 3, 2024, 9:32am UTC](https://community.prismic.io/t/fetch-data-from-content-relationship-in-slices/15825/3 "2024-05-03T09:32:15Z")

</div>

Hi,

I dont quite understand how to use GraphQuery, i think that's my problem.

```auto
graphQuery: `{
	         menu {
	             slices1 {
	                 ...on menu_item {
	                         variation {
	                             ...on withSubMenu {
	                                 primary {
	                                     sub_menu
	                                 }
	                             }
	                         }
	                     }
	                 }
	             }
              }
 	}`,

```

i tried something like this, but with no avail.

---

<div class="post-metadata">

**Author:** ![Phil](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/phil/32/14_2.png) [@Phil](https://community.prismic.io/u/Phil)\
**Post date:** [June 4, 2024, 10:40am UTC](https://community.prismic.io/t/fetch-data-from-content-relationship-in-slices/15825/8 "2024-06-04T10:40:28Z")

</div>

I lost this thread in my backlog @sho25052007, my apologies.

This thread shows how to create a successful GraphQuery for the mega menu:

> [@Mega menu](https://community.prismic.io/t/mega-menu/15111):
>
> I have a navigation menu similar to Prismic's navigation. Some navigation has a drop-down menu and some doesn't; see the image below. How do I create it, and how do I fetch it with Nextjs 14? Thank you in advance!
