fix(SW-190): added cache for content page query and added breadcrumbs fetching for content page
This commit is contained in:
@@ -4,6 +4,7 @@ import { request } from "@/lib/graphql/request"
|
||||
import { notFound } from "@/server/errors/trpc"
|
||||
import { contentstackExtendedProcedureUID, router } from "@/server/trpc"
|
||||
|
||||
import { generateTag } from "@/utils/generateTag"
|
||||
import { makeImageVaultImage } from "@/utils/imageVault"
|
||||
|
||||
import { validateContentPageSchema } from "./output"
|
||||
@@ -21,10 +22,17 @@ export const contentPageQueryRouter = router({
|
||||
get: contentstackExtendedProcedureUID.query(async ({ ctx }) => {
|
||||
const { lang, uid } = ctx
|
||||
|
||||
const response = await request<ContentPageDataRaw>(GetContentPage, {
|
||||
locale: lang,
|
||||
uid,
|
||||
})
|
||||
// TODO: Refs request should be done when adding more data to this query
|
||||
// which has references to other pages.
|
||||
|
||||
const response = await request<ContentPageDataRaw>(
|
||||
GetContentPage,
|
||||
{
|
||||
locale: lang,
|
||||
uid,
|
||||
},
|
||||
{ tags: [generateTag(lang, uid)] }
|
||||
)
|
||||
|
||||
if (!response.data) {
|
||||
throw notFound(response)
|
||||
|
||||
Reference in New Issue
Block a user