feat: sync design of header with current web
This commit is contained in:
9
server/routers/contentstack/config/input.ts
Normal file
9
server/routers/contentstack/config/input.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import z from "zod"
|
||||
|
||||
import { Lang } from "@/constants/languages"
|
||||
|
||||
export const headerInput = z
|
||||
.object({
|
||||
lang: z.nativeEnum(Lang),
|
||||
})
|
||||
.optional()
|
||||
@@ -4,6 +4,7 @@ import { request } from "@/lib/graphql/request"
|
||||
import { internalServerError, notFound } from "@/server/errors/trpc"
|
||||
import { contentstackProcedure, publicProcedure, router } from "@/server/trpc"
|
||||
|
||||
import { headerInput } from "./input"
|
||||
import {
|
||||
type ContactConfigData,
|
||||
HeaderData,
|
||||
@@ -34,11 +35,12 @@ export const configQueryRouter = router({
|
||||
|
||||
return validatedContactConfigConfig.data.all_contact_config.items[0]
|
||||
}),
|
||||
header: publicProcedure.query(async ({ ctx }) => {
|
||||
header: publicProcedure.input(headerInput).query(async ({ input, ctx }) => {
|
||||
const locale = input?.lang || ctx.lang
|
||||
const response = await request<HeaderDataRaw>(
|
||||
GetCurrentHeader,
|
||||
{ locale: ctx.lang },
|
||||
{ next: { tags: [`header-${ctx.lang}`] } }
|
||||
{ locale },
|
||||
{ next: { tags: [`header-${locale}`] } }
|
||||
)
|
||||
|
||||
if (!response.data) {
|
||||
|
||||
Reference in New Issue
Block a user