Skip to content

Commit

Permalink
Edit Product and Store
Browse files Browse the repository at this point in the history
  • Loading branch information
JAYDIPSINH27 committed Nov 11, 2021
1 parent c402759 commit 014db4d
Show file tree
Hide file tree
Showing 9 changed files with 820 additions and 16 deletions.
4 changes: 4 additions & 0 deletions client/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import Search from "./components/SearchBar/Search"
import DashboardHome from "./components/Dashboard/DashboardHome";
import ProductList from "./components/Dashboard/ProductList";
import AddProduct from "./components/Dashboard/AddProduct";
import EditProduct from "./components/Dashboard/EditProduct";
import EditStore from "./components/Dashboard/EditStore";
import StoreDetails from "./components/Dashboard/StoreDetails";
import Orders from "./components/Orders/OrderPage"
import AddStore from "./components/Dashboard/AddStore";
Expand Down Expand Up @@ -55,8 +57,10 @@ function App() {
<Route exact path="/dashboard" component={DashboardHome} />
<Route path="/dashboard/product/view" component={ProductList} />
<Route path="/dashboard/product/add" component={AddProduct} />
<Route path="/dashboard/product/edit/:id" component={EditProduct} />
<Route path="/dashboard/store/view" component={ShopList} />
<Route path="/dashboard/store/add" component={AddStore}/>
<Route path="/dashboard/store/edit/:id" component={EditStore}/>
</Switch>
</Layout>
</Switch>
Expand Down
18 changes: 16 additions & 2 deletions client/src/components/Dashboard/AddStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const AddStore = () => {
const classes = useStyles();
const [fileInput, setFileInput] = useState("");
const [previewSource, setPreviewSource] = useState("");
const [loading, setLoading] = useState(true);
const [loading, setLoading] = useState(false);
const history = new useHistory();

const [name, setName] = useState("");
Expand Down Expand Up @@ -142,11 +142,14 @@ const AddStore = () => {
console.log(err);
});
};
setTimeout(() => {
setLoading(true);
}, 1500);

return (
<>
<Container className={classes.container}>
{user.user && user.user.admin === true ? (
{user.user && user.user.admin === true ?loading? (
<>
<ToastContainer />
<form onSubmit={createShop}>
Expand Down Expand Up @@ -297,6 +300,17 @@ const AddStore = () => {
</div>
</form>
</>
)
:
(
<div className={classes.loadingDiv}>
<img
src={logo}
alt="loading..."
width="300px"
className={classes.loadingImage}
/>
</div>
) : (
<div className={classes.loadingDiv}>
<img
Expand Down
Loading

0 comments on commit 014db4d

Please sign in to comment.