feat: sync design of header with current web

This commit is contained in:
Christel Westerberg
2024-05-29 15:36:19 +02:00
parent 88dde3def4
commit 0ec6d58d6a
22 changed files with 122 additions and 225 deletions

View File

@@ -0,0 +1,9 @@
import z from "zod"
import { Lang } from "@/constants/languages"
export const headerInput = z
.object({
lang: z.nativeEnum(Lang),
})
.optional()

View File

@@ -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) {