refactor: fix validation budget input

This commit is contained in:
Mahen 2026-03-13 14:42:30 +07:00
parent da04cf694a
commit 8c345418b3
2 changed files with 6 additions and 2 deletions

View File

@ -236,6 +236,8 @@ export const ProfileModal = ({
{...register("budgetMin", { valueAsNumber: true })} {...register("budgetMin", { valueAsNumber: true })}
placeholder="Rp 0" placeholder="Rp 0"
className="border rounded-md focus:ring-2 focus:ring-primary mt-1" className="border rounded-md focus:ring-2 focus:ring-primary mt-1"
min={0}
max={100000000000}
/> />
{errors.budgetMin && ( {errors.budgetMin && (
<p className="text-red-500 text-xs"> <p className="text-red-500 text-xs">
@ -250,6 +252,8 @@ export const ProfileModal = ({
{...register("budgetMax", { valueAsNumber: true })} {...register("budgetMax", { valueAsNumber: true })}
placeholder="Rp 0" placeholder="Rp 0"
className="border rounded-md focus:ring-2 focus:ring-primary mt-1" className="border rounded-md focus:ring-2 focus:ring-primary mt-1"
min={0}
max={100000000000}
/> />
{errors.budgetMax && ( {errors.budgetMax && (
<p className="text-red-500 text-xs"> <p className="text-red-500 text-xs">

View File

@ -25,8 +25,8 @@ export const useProfileModal = ({
profession: pref.profession ?? "OTHER", profession: pref.profession ?? "OTHER",
preferredBrand: pref.preferredBrand ?? "OTHER", preferredBrand: pref.preferredBrand ?? "OTHER",
preferredOS: pref.preferredOS ?? "OTHER", preferredOS: pref.preferredOS ?? "OTHER",
budgetMin: pref.budgetMin ?? 0, budgetMin: pref.budgetMin === 0 || !pref.budgetMin ? "" : pref.budgetMin,
budgetMax: pref.budgetMax ?? 0, budgetMax: pref.budgetMax === 0 || !pref.budgetMax ? "" : pref.budgetMax,
}, },
}); });