feat: improve structure and error handling

This commit is contained in:
Michael Zetterberg
2024-05-14 15:55:46 +02:00
parent 01587d7fd5
commit f5108d1a8e
104 changed files with 1505 additions and 1570 deletions
+6
View File
@@ -0,0 +1,6 @@
export type LogoProps = {
height: number
src: string
title: string
width: number
}
-5
View File
@@ -1,5 +0,0 @@
import type { LangParams, LayoutArgs } from "@/types/params"
export interface MyPagesLayoutProps extends LayoutArgs<LangParams> {
breadcrumbs: React.ReactNode
}
+13 -1
View File
@@ -12,8 +12,20 @@ export type LangParams = {
lang: Lang
}
export type StatusParams = {
status: number
}
export type ContentTypeParams = {
contentType: "loyalty-page" | "content-page"
}
export type UIDParams = {
uid: string
}
export type UriParams = {
uri?: string
uri: string | string[]
}
export type PreviewParams = {
-13
View File
@@ -1,13 +0,0 @@
import z from "zod"
export const validateContentTypeUid = z.object({
all_content_page: z.object({
total: z.number(),
}),
all_loyalty_page: z.object({
total: z.number(),
}),
all_current_blocks_page: z.object({
total: z.number(),
}),
})
+19
View File
@@ -0,0 +1,19 @@
import z from "zod"
const entryResolveSchema = z.object({
items: z.array(
z.object({
system: z.object({
content_type_uid: z.string(),
uid: z.string(),
}),
})
),
total: z.number(),
})
export const validateEntryResolveSchema = z.object({
all_content_page: entryResolveSchema,
all_loyalty_page: entryResolveSchema,
all_current_blocks_page: entryResolveSchema,
})
-10
View File
@@ -1,10 +0,0 @@
import type { Image } from "../../image"
import type { EdgesWithTotalCount } from "../utils/edges"
export type LogoQueryData = {
all_header: {
items: {
logoConnection: EdgesWithTotalCount<Image>
}[]
}
}
-4
View File
@@ -15,10 +15,6 @@ export type MenuItem = {
subItems?: MenuItem[]
}
export type SidebarProps = {
lang: Lang
}
interface NavigationLink {
system: {
locale: Lang