mirror of
https://github.com/mudabbir-ahmad/Project-MAD-crudler.git
synced 2026-10-08 04:40:20 +00:00
Added modify functionality.
This commit is contained in:
1 parent
1f76cd8015
commit
924b57186f
3 files changed
+17
-7
No files matched your search
@@ -13,7 +13,7 @@ const defaultModule = {
|
||||
ModuleImage: null,
|
||||
};
|
||||
|
||||
const ModuleForm = ({onSubmit, onCancel}) => {
|
||||
const ModuleForm = ({originalModule, onSubmit, onCancel}) => {
|
||||
|
||||
// Initialisation -------------
|
||||
|
||||
@@ -31,7 +31,7 @@ const ModuleForm = ({onSubmit, onCancel}) => {
|
||||
|
||||
// State ----------------------
|
||||
|
||||
const [module, setModule] = useState(defaultModule);
|
||||
const [module, setModule] = useState(originalModule || defaultModule);
|
||||
|
||||
// Handlers -------------------
|
||||
|
||||
@@ -44,8 +44,8 @@ const ModuleForm = ({onSubmit, onCancel}) => {
|
||||
|
||||
// View -----------------------
|
||||
|
||||
const submitLabel = 'Add';
|
||||
const submitIcon = <Icons.Add/>;
|
||||
const submitLabel = originalModule ? 'Modify' : 'Add';
|
||||
const submitIcon = originalModule ? <Icons.Edit/> : <Icons.Add/>;
|
||||
|
||||
|
||||
return (
|
||||
|
||||
Reference in new issue
Block a user