fix: rename retried-wrapped fetch to make caching work again
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { GetLoyaltyPageMetaData } from "@/lib/graphql/Query/MetaDataLoyaltyPage.graphql"
|
||||
import { GetMyPagesMetaData } from "@/lib/graphql/Query/MetaDataMyPages.graphql"
|
||||
import { contentstackBaseProcedure, router } from "@/server/trpc"
|
||||
import { contentstackExtendedProcedureUID, router } from "@/server/trpc"
|
||||
|
||||
import {
|
||||
type GetLoyaltyPageMetaDataData,
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
validateLoyaltyPageMetaDataContentstackSchema,
|
||||
validateMyPagesMetaDataContentstackSchema,
|
||||
} from "./output"
|
||||
import { getMetaData, getResponse, Variables } from "./utils"
|
||||
import { getMetaData, getResponse, type Variables } from "./utils"
|
||||
|
||||
import { PageTypeEnum } from "@/types/requests/pageType"
|
||||
|
||||
@@ -23,13 +23,13 @@ async function getLoyaltyPageMetaData(variables: Variables) {
|
||||
|
||||
if (!validatedMetaDataData.success) {
|
||||
console.error(
|
||||
`Failed to validate Loyaltypage MetaData Data - (url: ${variables.url})`
|
||||
`Failed to validate Loyaltypage MetaData Data - (uid: ${variables.uid})`
|
||||
)
|
||||
console.error(validatedMetaDataData.error)
|
||||
return null
|
||||
}
|
||||
|
||||
return getMetaData(validatedMetaDataData.data.all_loyalty_page.items[0])
|
||||
return getMetaData(validatedMetaDataData.data.loyalty_page)
|
||||
}
|
||||
|
||||
async function getMyPagesMetaData(variables: Variables) {
|
||||
@@ -43,24 +43,20 @@ async function getMyPagesMetaData(variables: Variables) {
|
||||
|
||||
if (!validatedMetaDataData.success) {
|
||||
console.error(
|
||||
`Failed to validate My Page MetaData Data - (url: ${variables.url})`
|
||||
`Failed to validate My Page MetaData Data - (uid: ${variables.uid})`
|
||||
)
|
||||
console.error(validatedMetaDataData.error)
|
||||
return null
|
||||
}
|
||||
|
||||
return getMetaData(validatedMetaDataData.data.all_account_page.items[0])
|
||||
return getMetaData(validatedMetaDataData.data.account_page)
|
||||
}
|
||||
|
||||
export const metaDataQueryRouter = router({
|
||||
get: contentstackBaseProcedure.query(async ({ ctx }) => {
|
||||
if (!ctx.uid) {
|
||||
return []
|
||||
}
|
||||
|
||||
get: contentstackExtendedProcedureUID.query(async ({ ctx }) => {
|
||||
const variables = {
|
||||
locale: ctx.lang,
|
||||
url: ctx.pathname,
|
||||
uid: ctx.uid,
|
||||
}
|
||||
|
||||
switch (ctx.contentType) {
|
||||
@@ -69,7 +65,7 @@ export const metaDataQueryRouter = router({
|
||||
case PageTypeEnum.loyaltyPage:
|
||||
return await getLoyaltyPageMetaData(variables)
|
||||
default:
|
||||
return []
|
||||
return null
|
||||
}
|
||||
}),
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user