feat(WEB-209): revalidate my pages navigation on demand

This commit is contained in:
Simon Emanuelsson
2024-04-16 12:42:44 +02:00
committed by Michael Zetterberg
parent 16634abbbf
commit 1bffbc837e
40 changed files with 600 additions and 144 deletions

View File

@@ -1,4 +1,4 @@
fragment Breadcrumbs on AccountPage {
fragment MyPagesBreadcrumbs on AccountPage {
breadcrumbs {
title
parents: parentsConnection {

View File

@@ -0,0 +1,7 @@
#import "./System.graphql"
fragment AccountPageRef on AccountPage {
system {
...System
}
}

View File

@@ -0,0 +1,7 @@
#import "./System.graphql"
fragment ContentPageRef on ContentPage {
system {
...System
}
}

View File

@@ -0,0 +1,7 @@
#import "./System.graphql"
fragment LoyaltyPageRef on LoyaltyPage {
system {
...System
}
}

View File

@@ -0,0 +1,4 @@
fragment System on EntrySystemField {
content_type_uid
uid
}

View File

@@ -3,11 +3,10 @@
query GetMyPagesBreadcrumbs($locale: String!, $url: String!) {
all_account_page(locale: $locale, where: { url: $url }) {
items {
...Breadcrumbs
...MyPagesBreadcrumbs
system {
uid
}
}
total
}
}

View File

@@ -1,9 +1,13 @@
#import "../Fragments/PageLink/AccountPageLink.graphql"
#import "../Fragments/PageLink/ContentPageLink.graphql"
#import "../Fragments/PageLink/LoyaltyPageLink.graphql"
#import "../Fragments/Refs/AccountPage.graphql"
#import "../Fragments/Refs/ContentPage.graphql"
#import "../Fragments/Refs/LoyaltyPage.graphql"
#import "../Fragments/Refs/System.graphql"
query GetNavigationMyPages($locale: String!) {
all_navigation_my_pages(locale: $locale) {
all_navigation_my_pages(locale: $locale, limit: 1) {
items {
items {
... on NavigationMyPagesItemsItem {
@@ -20,8 +24,8 @@ query GetNavigationMyPages($locale: String!) {
node {
__typename
...AccountPageLink
...LoyaltyPageLink
...ContentPageLink
...LoyaltyPageLink
}
}
}
@@ -33,8 +37,8 @@ query GetNavigationMyPages($locale: String!) {
node {
__typename
...AccountPageLink
...LoyaltyPageLink
...ContentPageLink
...LoyaltyPageLink
}
}
}
@@ -45,3 +49,47 @@ query GetNavigationMyPages($locale: String!) {
}
}
}
query GetNavigationMyPagesRefs($locale: String!) {
all_navigation_my_pages(locale: $locale, limit: 1) {
items {
items {
... on NavigationMyPagesItemsItem {
__typename
item {
sub_items {
... on NavigationMyPagesItemsItemBlockSubItemsItem {
__typename
item {
pageConnection {
edges {
node {
__typename
...AccountPageRef
...ContentPageRef
...LoyaltyPageRef
}
}
}
}
}
}
pageConnection {
edges {
node {
__typename
...AccountPageRef
...ContentPageRef
...LoyaltyPageRef
}
}
}
}
}
}
system {
...System
}
}
}
}

View File

@@ -66,6 +66,7 @@ export async function request<T>(
return { data: response }
} catch (error) {
console.info(`GraphQL Request Error`)
console.error(error)
throw new Error("Something went wrong")
}