diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 43f705b..a1b2348 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -16,7 +16,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", @@ -5241,6 +5242,14 @@ "node": ">=0.8" } }, + "node_modules/clsx": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz", + "integrity": "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==", + "engines": { + "node": ">=6" + } + }, "node_modules/color-convert": { "version": "1.9.3", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", @@ -9458,6 +9467,18 @@ "react-dom": ">=16.8" } }, + "node_modules/react-toastify": { + "version": "10.0.6", + "resolved": "https://registry.npmjs.org/react-toastify/-/react-toastify-10.0.6.tgz", + "integrity": "sha512-yYjp+omCDf9lhZcrZHKbSq7YMuK0zcYkDFTzfRFgTXkTFHZ1ToxwAonzA4JI5CxA91JpjFLmwEsZEgfYfOqI1A==", + "dependencies": { + "clsx": "^2.1.0" + }, + "peerDependencies": { + "react": ">=18", + "react-dom": ">=18" + } + }, "node_modules/read-cache": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz", diff --git a/frontend/package.json b/frontend/package.json index 9189e45..43c0f28 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -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", diff --git a/frontend/src/pages/NewProduct.tsx b/frontend/src/pages/NewProduct.tsx index 87582e8..aaf1648 100644 --- a/frontend/src/pages/NewProduct.tsx +++ b/frontend/src/pages/NewProduct.tsx @@ -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; @@ -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); } @@ -164,8 +167,13 @@ const NewProduct = () => { - + ); };