Confirmation box#1
Conversation
| // Use IntelliSense to learn about possible attributes. | ||
| // Hover to view descriptions of existing attributes. | ||
| // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
| "version": "0.2.0", |
There was a problem hiding this comment.
removing this colon will probably break things... also don't know why you deleted the comment above
| import { InventoryTablesContainer } from "./Area/InventoryTableContainer"; | ||
|
|
||
| const App = () => { | ||
| const AppComp = ({ classes }) => { |
There was a problem hiding this comment.
use full names like AppComponent. AppComp is lazy and it makes the code less readable.
|
|
||
| export const ConfirmationBox = ({ open, setOpen, onDeleteHandler }) => { | ||
| return ( | ||
| <div> |
There was a problem hiding this comment.
This should be a Fragment not a div.
| const onSubmit = async (sku, amount) => { | ||
| await axios | ||
| .post("http://localhost:5000/api/inventory/" + sku + "/set/" + amount) | ||
| .then(function(response) { |
There was a problem hiding this comment.
This then isn't doing anything. It is also console logging the response. That isn't something you want to do outside of debugging.
| console.log(response); | ||
| }) | ||
| .catch(function(error) { | ||
| console.log(error); |
There was a problem hiding this comment.
1st. This should be console.err()
2nd. It would be better if this were logged to a true logger (more work than necessary here though)
3rd. it's better to not log the errors to the console for the user to read.
| }) | ||
| .catch(function(error) { | ||
| setError(true); | ||
| console.log(error); |
| await axios | ||
| .post("http://localhost:5000/api/inventory/" + sku + "/add/" + 1) | ||
| .then(function(response) { | ||
| console.log(response); |
| console.log(response); | ||
| }) | ||
| .catch(function(error) { | ||
| console.log(error); |
| }) | ||
| .catch(function(error) { | ||
| setError(true); | ||
| console.log(error); |
| .get("http://localhost:5000/api/products") | ||
| .then(function(response) { | ||
| setTables(response.data); | ||
| console.log(response); |
| fontSize: "10em" | ||
| }, | ||
| body: { | ||
| // fontSize: 14 |
| setError | ||
| }) => { | ||
| const [navToEditProduct, setNavToEditProduct] = React.useState(undefined); | ||
| const [incrementProduct, setIncrementProduct] = React.useState(undefined); |
There was a problem hiding this comment.
I don't see where this is being used... It looks like it should be deleted
| .get("http://localhost:5000/api/products") | ||
| .then(function(response) { | ||
| setTables(response.data); | ||
| console.log(response); |
| }) | ||
| .catch(function(error) { | ||
| setError(true); | ||
| console.log(error); |
| <IconButton | ||
| color="inherit" | ||
| aria-label="open drawer" | ||
| onClick={handleDrawerOpen} |
There was a problem hiding this comment.
instead of creating wrapper methods why not call setOpen directly here?
| }} | ||
| > | ||
| <div className={classes.drawerHeader}> | ||
| <IconButton onClick={handleDrawerClose}> |
There was a problem hiding this comment.
instead of creating wrapper methods why not call setOpen directly here?
| <h3 className={classes.searchHead}>Search:</h3> | ||
| <input className={classes.searchText}></input> | ||
| <Button variant="contained" color="primary" className={classes.searchBtn}> | ||
| <SearchIcon></SearchIcon> |
There was a problem hiding this comment.
this could be <SearchIcon />
| Quantity: location.state.navToEditProduct.quantity, | ||
| NotificationQuantity: location.state.navToEditProduct.notificationQuantity, | ||
| Price: 0, | ||
| Dimensions: "2x1", |
There was a problem hiding this comment.
This probably shouldn't be hard coded... if it isn't used then it really shouldn't be sent over the network anyway. This applies to all these hard coded values here
| setItemDeleted(true); | ||
| }; | ||
|
|
||
| if (itemDeleted) return <Redirect to="/"></Redirect>; |
There was a problem hiding this comment.
Are all three of these state values just to redirect to the root page? If so consolidate them to one state value for navigating to root
| console.log(response); | ||
| }) | ||
| .catch(function(error) { | ||
| // setError(true); |
There was a problem hiding this comment.
delete this if not being used
| location.state.navToEditProduct.sku | ||
| ) | ||
| .then(function(response) { | ||
| console.log(response); |
| }) | ||
| .catch(function(error) { | ||
| // setError(true); | ||
| console.log(error); |
|
|
||
| const NewProductPageComp = ({ classes }) => { | ||
| const [newProductForm, setNewProductForm] = React.useState({ | ||
| ProductName: "product", |
There was a problem hiding this comment.
Were you intending to put default values?
| console.log(response); | ||
| }) | ||
| .catch(function(error) { | ||
| // setError(true); |
| await axios | ||
| .post("http://localhost:5000/api/products/", newProductForm) | ||
| .then(function(response) { | ||
| console.log(response); |
| }) | ||
| .catch(function(error) { | ||
| // setError(true); | ||
| console.log(error); |
| SetFormSubmitted(true); | ||
| }; | ||
|
|
||
| if (formSubmitted) return <Redirect to="/"></Redirect>; |
There was a problem hiding this comment.
once again are both these states just to redirect to root? if so consolidate
| // Use IntelliSense to find out which attributes exist for C# debugging | ||
| // Use hover for the description of the existing attributes | ||
| // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md | ||
| "version": "0.2.0", |
There was a problem hiding this comment.
removing this colon will probably break things.. also why are you deleting these comments?
| @@ -1 +1 @@ | |||
| df8c9abfc30add6ff1506303db041d5dde3264b5 | |||
There was a problem hiding this comment.
All these files under server/bin and server/obj should be part of your .gitignore not checked in to VC
please check out Mainly the confirmation box. There were a few bug fixes but not many.