Skip to content

Commit 09c8317

Browse files
committed
2 parents 39ca2f7 + 831579a commit 09c8317

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/app/camps/[slug]/page.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ const formSchema = z.object({
3333
nickname: z.string().min(1, "กรุณากรอกชื่อเล่น"),
3434
gender: z.string().min(1, "กรุณาเลือกเพศ"),
3535
birth_date: z.string().min(1, "กรุณาเลือกวันเกิด"),
36+
email: z.string().refine((email) => email.includes('@') && email.includes('.'), {
37+
message: "กรุณากรอกอีเมลให้ถูกต้อง"
38+
}),
3639
question1: z.string().min(1, "กรุณาตอบคำถาม"),
3740
question2: z.string().min(1, "กรุณาตอบคำถาม"),
3841
question3: z.string().min(1, "กรุณาตอบคำถาม"),
@@ -88,6 +91,7 @@ export default function CampPage({ params }: { params: Promise<{ slug: string }>
8891
nickname: "",
8992
gender: "",
9093
birth_date: "",
94+
email: "",
9195
question1: "",
9296
question2: "",
9397
question3: "",
@@ -127,6 +131,7 @@ export default function CampPage({ params }: { params: Promise<{ slug: string }>
127131
nickname: profileData.nickname || "",
128132
gender: profileData.gender || "",
129133
birth_date: profileData.birth_date || "",
134+
email: profileData.email || "",
130135
question1: "",
131136
question2: "",
132137
question3: "",
@@ -452,6 +457,19 @@ export default function CampPage({ params }: { params: Promise<{ slug: string }>
452457
</FormItem>
453458
)}
454459
/>
460+
<FormField
461+
control={form.control}
462+
name="email"
463+
render={({ field }) => (
464+
<FormItem>
465+
<FormLabel>อีเมล</FormLabel>
466+
<FormControl>
467+
<Input type="text" placeholder="[email protected]" {...field} />
468+
</FormControl>
469+
<FormMessage />
470+
</FormItem>
471+
)}
472+
/>
455473
<FormField
456474
control={form.control}
457475
name="gender"

0 commit comments

Comments
 (0)