feat: add validation to enter details flow
This commit is contained in:
@@ -2,10 +2,10 @@ import { z } from "zod"
|
||||
|
||||
import { detailsSchema } from "@/components/HotelReservation/EnterDetails/Details/schema"
|
||||
|
||||
import { User } from "@/types/user"
|
||||
import type { SafeUser } from "@/types/user"
|
||||
|
||||
export interface DetailsSchema extends z.output<typeof detailsSchema> {}
|
||||
|
||||
export interface DetailsProps {
|
||||
user: User | null
|
||||
user: SafeUser
|
||||
}
|
||||
|
||||
6
types/components/enterDetails/step.ts
Normal file
6
types/components/enterDetails/step.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
export enum StepEnum {
|
||||
selectBed = "select-bed",
|
||||
breakfast = "breakfast",
|
||||
details = "details",
|
||||
payment = "payment",
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
import { StepEnum } from "../../enterDetails/step"
|
||||
|
||||
export interface SectionAccordionProps {
|
||||
header: string
|
||||
isOpen: boolean
|
||||
isCompleted: boolean
|
||||
label: string
|
||||
path: string
|
||||
step: StepEnum
|
||||
}
|
||||
|
||||
@@ -1,15 +1,23 @@
|
||||
import { z } from "zod"
|
||||
|
||||
import { creditCardSchema, getUserSchema, membershipSchema } from "@/server/routers/user/output"
|
||||
import {
|
||||
creditCardSchema,
|
||||
getUserSchema,
|
||||
membershipSchema,
|
||||
} from "@/server/routers/user/output"
|
||||
|
||||
import type { RouterOutput } from "@/lib/trpc/client"
|
||||
|
||||
/**
|
||||
* All extended field needs to be added by API team to response or
|
||||
* we have to get the values from elsewhere
|
||||
*/
|
||||
export interface User extends z.output<typeof getUserSchema> { }
|
||||
export interface User extends z.output<typeof getUserSchema> {}
|
||||
|
||||
export type SafeUser = RouterOutput["user"]["getSafely"]
|
||||
|
||||
export type CreditCard = z.output<typeof creditCardSchema>
|
||||
|
||||
export interface Membership extends z.output<typeof membershipSchema> { }
|
||||
export interface Membership extends z.output<typeof membershipSchema> {}
|
||||
|
||||
export type Memberships = Membership[]
|
||||
|
||||
Reference in New Issue
Block a user