sửa lỗi form không reset, cập nhật thêm hàm gọi api khi thêm mới tàu

This commit is contained in:
Tran Anh Tuan
2025-12-10 20:05:34 +07:00
parent 35027a7e23
commit 12fb7c48ed
3 changed files with 19 additions and 5 deletions

View File

@@ -96,6 +96,12 @@ const CreateOrUpdateShip = (props: CreateOrUpdateShipProps) => {
}
}, [props.isOpen, props.initialValue, reset]);
useEffect(() => {
if (props.type === "create") {
reset(props.initialValue);
}
}, [props.isOpen]);
// Prepare options for selects
const shipTypeOptions = useMemo<SelectOption[]>(() => {
return (shipTypes || []).map((type) => ({