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

@@ -0,0 +1,18 @@
import type { GetNavigationMyPagesRefsData } from "@/types/requests/myPages/navigation"
import type { Edges } from "@/types/requests/utils/edges"
import type { NodeRefs } from "@/types/requests/utils/refs"
export function getConnections(refs: GetNavigationMyPagesRefsData) {
const connections: Edges<NodeRefs>[] = []
refs.all_navigation_my_pages.items.forEach((ref) => {
ref.items.forEach(({ item }) => {
connections.push(item.pageConnection)
item.sub_items.forEach(({ item: subItem }) => {
connections.push(subItem.pageConnection)
})
})
})
return connections
}