-
-
Save designviacode/f52b92f2613a9209b7aa9e6f0e923682 to your computer and use it in GitHub Desktop.
Revisions
-
Brian Jenkins revised this gist
Dec 29, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ // Destructuring cleans it up a bit const { postCatalogues, updateCatalogues } = this.props; const { catalogueName, activeStatusValidation } = formValidation; // Bail early if (catalogueName || activeStatusValidation) return; -
Brian Jenkins revised this gist
Dec 29, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ // Destructuring cleans it up a bit const { catalogueName, activeStatusValidation } = formValidation; const { postCatalogues, updateCatalogues } = this.props; // Bail early -
Brian Jenkins revised this gist
Dec 29, 2017 . 1 changed file with 5 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,7 @@ // Destructuring cleans it up a bit const {catalogueName, activeStatusValidation} = formValidation; const { postCatalogues, updateCatalogues } = this.props; // Bail early if (catalogueName || activeStatusValidation) return; @@ -8,11 +11,11 @@ if (catalogueName || activeStatusValidation) return; const submitActions = { add: () => { // I'm not sure where cataologue is defined so you may need to include this as an argument in the add function? postCatalogues(catalogue); }, edit: () => { // Same comment about _id and catalogue as the add function above updateCatalogues(_id, catalogue); } } -
Brian Jenkins revised this gist
Dec 28, 2017 . 1 changed file with 2 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,6 @@ const {catalogueName, activeStatusValidation} = formValidation; // Bail early if (catalogueName || activeStatusValidation) return; // Model the data to avoid a switch - this makes more sense to me - seems more clear - you could even take this out of // this method completely and include it as a property on the React component, as you may end up with more than add and edit, -
Brian Jenkins created this gist
Dec 28, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ // Bail early if (formValidation.catalogueName !== null && formValidation.activeStatusValidation !== null) { return null; } // Model the data to avoid a switch - this makes more sense to me - seems more clear - you could even take this out of // this method completely and include it as a property on the React component, as you may end up with more than add and edit, // and perhaps it will be needed elsewhere? const submitActions = { add: () => { // I'm not sure where cataologue is defined so you may need to include this as an argument in the add function? this.props.postCatalogues(catalogue); }, edit: () => { // Same comment about _id and catalogue as the add function above this.props.updateCatalogues(_id, catalogue); } } submitActions[submitType](); // Keep it DRY. If you're going to call this.close() on both add and edit, then might as well call it here this.close();