refactor: update names
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
fragment MyPagesBreadcrumbs on AccountPage {
|
||||
fragment AccountPageBreadcrumbs on AccountPage {
|
||||
breadcrumbs {
|
||||
title
|
||||
parentsConnection {
|
||||
@@ -20,7 +20,7 @@ fragment MyPagesBreadcrumbs on AccountPage {
|
||||
}
|
||||
}
|
||||
|
||||
fragment LoyaltyBreadcrumbs on LoyaltyPage {
|
||||
fragment LoyaltyPageBreadcrumbs on LoyaltyPage {
|
||||
web {
|
||||
breadcrumbss {
|
||||
title
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#import "./System.graphql"
|
||||
|
||||
fragment MyPagesBreadcrumbsRefs on AccountPage {
|
||||
fragment AccountPageBreadcrumbsRefs on AccountPage {
|
||||
breadcrumbs {
|
||||
parentsConnection {
|
||||
edges {
|
||||
@@ -19,7 +19,7 @@ fragment MyPagesBreadcrumbsRefs on AccountPage {
|
||||
}
|
||||
}
|
||||
|
||||
fragment LoyaltyBreadcrumbsRefs on LoyaltyPage {
|
||||
fragment LoyaltyPageBreadcrumbsRefs on LoyaltyPage {
|
||||
web {
|
||||
breadcrumbss {
|
||||
title
|
||||
@@ -31,11 +31,8 @@ fragment LoyaltyBreadcrumbsRefs on LoyaltyPage {
|
||||
title
|
||||
}
|
||||
system {
|
||||
uid
|
||||
locale
|
||||
content_type_uid
|
||||
...System
|
||||
}
|
||||
url
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#import "../Fragments/MyPages/Breadcrumbs.graphql"
|
||||
#import "../Fragments/Refs/Breadcrumbs.graphql"
|
||||
|
||||
query GetMyPagesBreadcrumbs($locale: String!, $url: String!) {
|
||||
query GetAccountPageBreadcrumbs($locale: String!, $url: String!) {
|
||||
all_account_page(locale: $locale, where: { url: $url }) {
|
||||
items {
|
||||
...MyPagesBreadcrumbs
|
||||
...AccountPageBreadcrumbs
|
||||
system {
|
||||
uid
|
||||
}
|
||||
@@ -12,10 +12,10 @@ query GetMyPagesBreadcrumbs($locale: String!, $url: String!) {
|
||||
}
|
||||
}
|
||||
|
||||
query GetMyPagesBreadcrumbsRefs($locale: String!, $url: String!) {
|
||||
query GetAccountPageBreadcrumbsRefs($locale: String!, $url: String!) {
|
||||
all_account_page(locale: $locale, where: { url: $url }) {
|
||||
items {
|
||||
...MyPagesBreadcrumbsRefs
|
||||
...AccountPageBreadcrumbsRefs
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
#import "../Fragments/MyPages/Breadcrumbs.graphql"
|
||||
#import "../Fragments/Refs/Breadcrumbs.graphql"
|
||||
|
||||
query GetLoyaltyBreadcrumbs($locale: String!, $url: String!) {
|
||||
query GetLoyaltyPageBreadcrumbs($locale: String!, $url: String!) {
|
||||
all_loyalty_page(locale: $locale, where: { url: $url }) {
|
||||
items {
|
||||
...LoyaltyBreadcrumbs
|
||||
...LoyaltyPageBreadcrumbs
|
||||
system {
|
||||
uid
|
||||
}
|
||||
@@ -12,10 +12,10 @@ query GetLoyaltyBreadcrumbs($locale: String!, $url: String!) {
|
||||
}
|
||||
}
|
||||
|
||||
query GetLoyaltyBreadcrumbsRefs($locale: String!, $url: String!) {
|
||||
query GetLoyaltyPageBreadcrumbsRefs($locale: String!, $url: String!) {
|
||||
all_loyalty_page(locale: $locale, where: { url: $url }) {
|
||||
items {
|
||||
...LoyaltyBreadcrumbsRefs
|
||||
...LoyaltyPageBreadcrumbsRefs
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
import {
|
||||
GetLoyaltyBreadcrumbs,
|
||||
GetLoyaltyBreadcrumbsRefs,
|
||||
} from "@/lib/graphql/Query/BreadcrumbsLoyaltyPages.graphql"
|
||||
GetAccountPageBreadcrumbs,
|
||||
GetAccountPageBreadcrumbsRefs,
|
||||
} from "@/lib/graphql/Query/BreadcrumbsAccountPage.graphql"
|
||||
import {
|
||||
GetMyPagesBreadcrumbs,
|
||||
GetMyPagesBreadcrumbsRefs,
|
||||
} from "@/lib/graphql/Query/BreadcrumbsMyPages.graphql"
|
||||
GetLoyaltyPageBreadcrumbs,
|
||||
GetLoyaltyPageBreadcrumbsRefs,
|
||||
} from "@/lib/graphql/Query/BreadcrumbsLoyaltyPage.graphql"
|
||||
import { request } from "@/lib/graphql/request"
|
||||
import { internalServerError, notFound } from "@/server/errors/trpc"
|
||||
import { contentstackProcedure, router } from "@/server/trpc"
|
||||
@@ -32,16 +32,16 @@ import {
|
||||
} from "./utils"
|
||||
|
||||
import type {
|
||||
GetLoyaltyBreadcrumbsData,
|
||||
GetLoyaltyBreadcrumbsRefsData,
|
||||
GetMyPagesBreadcrumbsData,
|
||||
GetMyPagesBreadcrumbsRefsData,
|
||||
GetAccountPageBreadcrumbsData,
|
||||
GetAccountPageBreadcrumbsRefsData,
|
||||
GetLoyaltyPageBreadcrumbsData,
|
||||
GetLoyaltyPageBreadcrumbsRefsData,
|
||||
} from "@/types/requests/myPages/breadcrumbs"
|
||||
|
||||
export const breadcrumbsQueryRouter = router({
|
||||
get: contentstackProcedure.query(async ({ ctx }) => {
|
||||
const refsResponse = await request<GetMyPagesBreadcrumbsRefsData>(
|
||||
GetMyPagesBreadcrumbsRefs,
|
||||
const refsResponse = await request<GetAccountPageBreadcrumbsRefsData>(
|
||||
GetAccountPageBreadcrumbsRefs,
|
||||
{ locale: ctx.lang, url: ctx.pathname },
|
||||
{
|
||||
next: {
|
||||
@@ -71,8 +71,8 @@ export const breadcrumbsQueryRouter = router({
|
||||
tags.push(generateTag(ctx.lang, page.system.uid, affix))
|
||||
console.log(tags)
|
||||
|
||||
const response = await request<GetMyPagesBreadcrumbsData>(
|
||||
GetMyPagesBreadcrumbs,
|
||||
const response = await request<GetAccountPageBreadcrumbsData>(
|
||||
GetAccountPageBreadcrumbs,
|
||||
{ locale: ctx.lang, url: ctx.pathname },
|
||||
{ next: { tags } }
|
||||
)
|
||||
@@ -125,8 +125,8 @@ export const breadcrumbsQueryRouter = router({
|
||||
}),
|
||||
loyalty: contentstackProcedure.query(async ({ ctx }) => {
|
||||
console.log("HEJ", ctx)
|
||||
const refsResponse = await request<GetLoyaltyBreadcrumbsRefsData>(
|
||||
GetLoyaltyBreadcrumbsRefs,
|
||||
const refsResponse = await request<GetLoyaltyPageBreadcrumbsRefsData>(
|
||||
GetLoyaltyPageBreadcrumbsRefs,
|
||||
{ locale: ctx.lang, url: ctx.pathname },
|
||||
{
|
||||
next: {
|
||||
@@ -170,8 +170,8 @@ export const breadcrumbsQueryRouter = router({
|
||||
tags.push(generateTag(ctx.lang, page.system.uid, affix))
|
||||
console.log(tags)
|
||||
|
||||
const response = await request<GetLoyaltyBreadcrumbsData>(
|
||||
GetLoyaltyBreadcrumbs,
|
||||
const response = await request<GetLoyaltyPageBreadcrumbsData>(
|
||||
GetLoyaltyPageBreadcrumbs,
|
||||
{ locale: ctx.lang, url: ctx.pathname },
|
||||
{ next: { tags } }
|
||||
)
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { Lang } from "@/constants/languages"
|
||||
|
||||
import type {
|
||||
GetLoyaltyBreadcrumbsRefsData,
|
||||
GetMyPagesBreadcrumbsRefsData,
|
||||
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: GetMyPagesBreadcrumbsRefsData) {
|
||||
export function getConnections(refs: GetAccountPageBreadcrumbsRefsData) {
|
||||
const connections: Edges<NodeRefs>[] = []
|
||||
refs.all_account_page.items.forEach((ref) => {
|
||||
console.log(ref)
|
||||
@@ -18,7 +18,7 @@ export function getConnections(refs: GetMyPagesBreadcrumbsRefsData) {
|
||||
return connections
|
||||
}
|
||||
|
||||
export function getConnectionsLoyalty(refs: GetLoyaltyBreadcrumbsRefsData) {
|
||||
export function getConnectionsLoyalty(refs: GetLoyaltyPageBreadcrumbsRefsData) {
|
||||
const connections: Edges<NodeRefs>[] = []
|
||||
refs.all_loyalty_page.items.forEach((ref) => {
|
||||
console.log(ref)
|
||||
|
||||
@@ -22,7 +22,7 @@ interface AccountPageBreadcrumbs {
|
||||
uid: string
|
||||
}
|
||||
}
|
||||
interface LoyaltyBreadcrumbs {
|
||||
interface LoyaltyPageBreadcrumbs {
|
||||
web: {
|
||||
breadcrumbss: {
|
||||
title: string
|
||||
@@ -47,13 +47,13 @@ interface AllAccountPageResponse
|
||||
extends AllRequestResponse<AccountPageBreadcrumbs> {}
|
||||
|
||||
interface AllLoyaltyPageResponse
|
||||
extends AllRequestResponse<LoyaltyBreadcrumbs> {}
|
||||
extends AllRequestResponse<LoyaltyPageBreadcrumbs> {}
|
||||
|
||||
export interface GetMyPagesBreadcrumbsData {
|
||||
export interface GetAccountPageBreadcrumbsData {
|
||||
all_account_page: AllAccountPageResponse
|
||||
}
|
||||
|
||||
export interface GetLoyaltyBreadcrumbsData {
|
||||
export interface GetLoyaltyPageBreadcrumbsData {
|
||||
all_loyalty_page: AllLoyaltyPageResponse
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ interface AccountPageBreadcrumbRefs extends System {
|
||||
}
|
||||
}
|
||||
|
||||
interface LoyaltyBreadcrumbRefs extends System {
|
||||
interface LoyaltyPageBreadcrumbRefs extends System {
|
||||
web: {
|
||||
breadcrumbss: {
|
||||
parentsConnection: Edges<System>
|
||||
@@ -75,12 +75,12 @@ interface AllAccountPageRefsResponse
|
||||
extends AllRequestResponse<AccountPageBreadcrumbRefs> {}
|
||||
|
||||
interface AllLoyaltyPageRefsResponse
|
||||
extends AllRequestResponse<LoyaltyBreadcrumbRefs> {}
|
||||
extends AllRequestResponse<LoyaltyPageBreadcrumbRefs> {}
|
||||
|
||||
export interface GetMyPagesBreadcrumbsRefsData {
|
||||
export interface GetAccountPageBreadcrumbsRefsData {
|
||||
all_account_page: AllAccountPageRefsResponse
|
||||
}
|
||||
|
||||
export interface GetLoyaltyBreadcrumbsRefsData {
|
||||
export interface GetLoyaltyPageBreadcrumbsRefsData {
|
||||
all_loyalty_page: AllLoyaltyPageRefsResponse
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user