fix: add nullable values for account page
This commit is contained in:
@@ -13,8 +13,8 @@ import { RTEDocument } from "@/types/rte/node"
|
|||||||
const accountPageShortcuts = z.object({
|
const accountPageShortcuts = z.object({
|
||||||
__typename: z.literal(ContentEntries.AccountPageContentShortcuts),
|
__typename: z.literal(ContentEntries.AccountPageContentShortcuts),
|
||||||
shortcuts: z.object({
|
shortcuts: z.object({
|
||||||
title: z.string().optional(),
|
title: z.string().nullable(),
|
||||||
preamble: z.string().optional(),
|
preamble: z.string().nullable(),
|
||||||
shortcuts: z.array(
|
shortcuts: z.array(
|
||||||
z.object({
|
z.object({
|
||||||
linkConnection: z.object({
|
linkConnection: z.object({
|
||||||
@@ -25,7 +25,7 @@ const accountPageShortcuts = z.object({
|
|||||||
uid: z.string(),
|
uid: z.string(),
|
||||||
locale: z.nativeEnum(Lang),
|
locale: z.nativeEnum(Lang),
|
||||||
}),
|
}),
|
||||||
original_url: z.string().optional(),
|
original_url: z.string().nullable().optional(),
|
||||||
url: z.string(),
|
url: z.string(),
|
||||||
title: z.string(),
|
title: z.string(),
|
||||||
}),
|
}),
|
||||||
@@ -33,7 +33,7 @@ const accountPageShortcuts = z.object({
|
|||||||
),
|
),
|
||||||
totalCount: z.number(),
|
totalCount: z.number(),
|
||||||
}),
|
}),
|
||||||
text: z.string().optional(),
|
text: z.string().nullable(),
|
||||||
open_in_new_tab: z.boolean(),
|
open_in_new_tab: z.boolean(),
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
@@ -43,8 +43,8 @@ const accountPageShortcuts = z.object({
|
|||||||
const accountPageDynamicContent = z.object({
|
const accountPageDynamicContent = z.object({
|
||||||
__typename: z.literal(ContentEntries.AccountPageContentDynamicContent),
|
__typename: z.literal(ContentEntries.AccountPageContentDynamicContent),
|
||||||
dynamic_content: z.object({
|
dynamic_content: z.object({
|
||||||
title: z.string().optional(),
|
title: z.string().nullable(),
|
||||||
preamble: z.string().optional(),
|
preamble: z.string().nullable(),
|
||||||
component: z.nativeEnum(DynamicContentComponents),
|
component: z.nativeEnum(DynamicContentComponents),
|
||||||
link: z.object({
|
link: z.object({
|
||||||
linkConnection: z.object({
|
linkConnection: z.object({
|
||||||
@@ -56,7 +56,7 @@ const accountPageDynamicContent = z.object({
|
|||||||
locale: z.nativeEnum(Lang),
|
locale: z.nativeEnum(Lang),
|
||||||
}),
|
}),
|
||||||
url: z.string(),
|
url: z.string(),
|
||||||
original_url: z.string().optional(),
|
original_url: z.string().nullable().optional(),
|
||||||
title: z.string(),
|
title: z.string(),
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
@@ -65,7 +65,6 @@ const accountPageDynamicContent = z.object({
|
|||||||
}),
|
}),
|
||||||
link_text: z.string(),
|
link_text: z.string(),
|
||||||
}),
|
}),
|
||||||
// .optional(),
|
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ export const accountPageQueryRouter = router({
|
|||||||
)
|
)
|
||||||
|
|
||||||
if (!validatedAccountPage.success) {
|
if (!validatedAccountPage.success) {
|
||||||
|
console.info(`Get Account Page Validation Error`)
|
||||||
|
console.error(validatedAccountPage.error)
|
||||||
throw badRequestError()
|
throw badRequestError()
|
||||||
}
|
}
|
||||||
// TODO: Make returned data nicer
|
// TODO: Make returned data nicer
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { Lang } from "@/constants/languages"
|
|
||||||
import { z } from "zod"
|
import { z } from "zod"
|
||||||
|
|
||||||
|
import { Lang } from "@/constants/languages"
|
||||||
|
|
||||||
export const validateBreadcrumbsRefsConstenstackSchema = z.object({
|
export const validateBreadcrumbsRefsConstenstackSchema = z.object({
|
||||||
all_account_page: z.object({
|
all_account_page: z.object({
|
||||||
items: z.array(
|
items: z.array(
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ import { DynamicContentComponents } from "@/types/components/myPages/myPage/enum
|
|||||||
export type AccountPageContentProps = {
|
export type AccountPageContentProps = {
|
||||||
component: DynamicContentComponents
|
component: DynamicContentComponents
|
||||||
props: {
|
props: {
|
||||||
title?: string
|
title: string | null
|
||||||
subtitle?: string
|
subtitle: string | null
|
||||||
link?: { href: string; text: string }
|
link?: { href: string; text: string }
|
||||||
lang: Lang
|
lang: Lang
|
||||||
}
|
}
|
||||||
@@ -15,8 +15,8 @@ export type AccountPageContentProps = {
|
|||||||
|
|
||||||
export type AccountPageComponentProps = {
|
export type AccountPageComponentProps = {
|
||||||
lang: Lang
|
lang: Lang
|
||||||
title?: string
|
title: string | null
|
||||||
subtitle?: string
|
subtitle: string | null
|
||||||
link?: { href: string; text: string }
|
link?: { href: string; text: string }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import type { User } from "@/types/user"
|
import type { User } from "@/types/user"
|
||||||
|
|
||||||
export type OverviewProps = {
|
export type OverviewProps = {
|
||||||
title?: string
|
title: string | null
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
export type HeaderProps = {
|
export type HeaderProps = {
|
||||||
title?: string
|
title: string | null
|
||||||
subtitle?: string
|
subtitle: string | null
|
||||||
link?: { href: string; text: string }
|
link?: { href: string; text: string }
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user