refactor: move GrapQL fragments

This commit is contained in:
Arvid Norlin
2024-04-11 13:15:34 +02:00
parent ff8ea6d86a
commit 4b486ab344
3 changed files with 44 additions and 42 deletions

View File

@@ -55,7 +55,7 @@ export default async function MyPagesLayout({
}
})
}
// navigation_my_pages is of type Single, hence the hard [0]
const navigation = response.data.all_navigation_my_pages.items[0]
const menuItems = mapMenuItems(navigation.items)

View File

@@ -6,3 +6,37 @@ fragment CurrentBlocksPageLink on CurrentBlocksPage {
title
url
}
fragment CodeDefinedPageLink on CodeDefinedPage {
system {
uid
}
title
url
}
fragment AccountPageLink on AccountPage {
system {
uid
}
title
url
}
fragment LoyaltyPageLink on LoyaltyPage {
system {
uid
}
title
url
}
fragment ContentPageLink on ContentPage {
system {
uid
}
web {
url
}
title
}

View File

@@ -1,36 +1,4 @@
fragment CodeDefinedPage on CodeDefinedPage {
title
url
system {
uid
}
}
fragment AccountPage on AccountPage {
title
url
system {
uid
}
}
fragment LoyaltyPage on LoyaltyPage {
title
url
system {
uid
}
}
fragment ContentPage on ContentPage {
title
web {
url
}
system {
uid
}
}
#import "../Fragments/PageLinks.graphql"
query GetNavigationMyPages {
all_navigation_my_pages {
@@ -49,10 +17,10 @@ query GetNavigationMyPages {
edges {
node {
__typename
...AccountPage
...LoyaltyPage
...CodeDefinedPage
...ContentPage
...AccountPageLink
...LoyaltyPageLink
...CodeDefinedPageLink
...ContentPageLink
}
}
}
@@ -63,10 +31,10 @@ query GetNavigationMyPages {
edges {
node {
__typename
...AccountPage
...LoyaltyPage
...ContentPage
...CodeDefinedPage
...AccountPageLink
...LoyaltyPageLink
...ContentPageLink
...CodeDefinedPageLink
}
}
}