66 lines
1.5 KiB
TypeScript
66 lines
1.5 KiB
TypeScript
import { Lang } from "@/constants/languages"
|
|
|
|
import type {
|
|
GetAccountPageBreadcrumbsRefsData,
|
|
GetLoyaltyPageBreadcrumbsRefsData,
|
|
} from "@/types/requests/myPages/breadcrumbs"
|
|
import type { Edges } from "@/types/requests/utils/edges"
|
|
import type { NodeRefs } from "@/types/requests/utils/refs"
|
|
|
|
export function getConnections(refs: GetAccountPageBreadcrumbsRefsData) {
|
|
const connections: Edges<NodeRefs>[] = []
|
|
refs.all_account_page.items.forEach((ref) => {
|
|
console.log(ref.web.breadcrumbs)
|
|
console.log(ref.web.breadcrumbs.parentsConnection)
|
|
connections.push(ref.web.breadcrumbs.parentsConnection)
|
|
})
|
|
|
|
return connections
|
|
}
|
|
|
|
export function getConnectionsLoyalty(refs: GetLoyaltyPageBreadcrumbsRefsData) {
|
|
const connections: Edges<NodeRefs>[] = []
|
|
refs.all_loyalty_page.items.forEach((ref) => {
|
|
console.log(ref)
|
|
connections.push(ref.web.breadcrumbs.parentsConnection)
|
|
})
|
|
console.log(connections)
|
|
return connections
|
|
}
|
|
|
|
export const affix = "breadcrumbs"
|
|
|
|
// TODO: Make these editable in CMS?
|
|
export const homeBreadcrumbs = {
|
|
[Lang.da]: {
|
|
href: "/da",
|
|
title: "Hjem",
|
|
uid: "da",
|
|
},
|
|
[Lang.de]: {
|
|
href: "/de",
|
|
title: "Heim",
|
|
uid: "de",
|
|
},
|
|
[Lang.en]: {
|
|
href: "/en",
|
|
title: "Home",
|
|
uid: "en",
|
|
},
|
|
[Lang.fi]: {
|
|
href: "/fi",
|
|
title: "Koti",
|
|
uid: "fi",
|
|
},
|
|
[Lang.no]: {
|
|
href: "/no",
|
|
title: "Hjem",
|
|
uid: "no",
|
|
},
|
|
[Lang.sv]: {
|
|
href: "/sv",
|
|
title: "Hem",
|
|
uid: "sv",
|
|
},
|
|
}
|