Skip to content

Commit eb986e7

Browse files
committed
fix validation
1 parent c232d6e commit eb986e7

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/components/profile.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,15 @@ import { zodResolver } from "@hookform/resolvers/zod"
2727
import { useState } from "react"
2828
import { useForm } from "react-hook-form"
2929
import { useTranslation } from "react-i18next"
30+
import { asOptionalField } from "@/lib/utils"
3031
import { toast } from "sonner"
3132
import { z } from "zod"
3233

3334
const profileFormSchema = z.object({
3435
original_password: z.string().min(5).max(72),
3536
new_password: z.string().min(8).max(72),
3637
new_username: z.string().min(1).max(32),
37-
reject_password: z.boolean(),
38+
reject_password: asOptionalField(z.boolean()),
3839
})
3940

4041
export const ProfileCard = ({ className }: { className: string }) => {

src/types/api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ export interface ModelProfileForm {
506506
new_password: string;
507507
new_username: string;
508508
original_password: string;
509-
reject_password: boolean;
509+
reject_password?: boolean;
510510
}
511511

512512
export interface ModelRule {

0 commit comments

Comments
 (0)