Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

142/handle-add-product-admin: toastify when admin added a new product #152

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-responsive": "^10.0.0",
"react-router-dom": "^6.24.0"
"react-router-dom": "^6.24.0",
"react-toastify": "^10.0.6"
},
"devDependencies": {
"@graphql-codegen/cli": "^5.0.2",
Expand Down
10 changes: 9 additions & 1 deletion frontend/src/pages/NewProduct.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import ListProductsTable from "../components/ListProductsTable";
import { NewProductFormValues } from "../interface/types";
import { useState } from "react";
import axios from "axios";
import { toast, ToastContainer } from "react-toastify";
import 'react-toastify/dist/ReactToastify.css';

const { Title } = Typography;

Expand Down Expand Up @@ -79,6 +81,7 @@ const NewProduct = () => {
variables: { data: formJson },
});
form.resetFields();
toast("Produit ajouté avec succès !");
} catch (error) {
console.error("Erreur lors de la création du produit", error);
}
Expand Down Expand Up @@ -164,8 +167,13 @@ const NewProduct = () => {
</Form>
</Card>
</div>

<ListProductsTable />
<ToastContainer
position="top-right"
autoClose={5000}
theme="light"

/>
</>
);
};
Expand Down
Loading