[] = [
const user = row.original;
return
= ({ user, type }) => {
const formData = new FormData(e.currentTarget);
const data = Object.fromEntries(formData.entries());
- if (!updatePassword) {
+ if (type === "EDIT" && !updatePassword) {
delete data.password; // Hapus password jika user memilih tidak mengupdate password
}
const method = type === "EDIT" ? "PUT" : "POST";
@@ -56,6 +56,7 @@ const UserForm: FC = ({ user, type }) => {
toast.error("An error occurred while submitting the form");
}
};
+
return (
<>
- {type === "EDIT" && (
-
+ )}
+ {type === "EDIT" && (
+
+
+
+ )}