[+] react-toastify integration

This commit is contained in:
Charles Le Maux 2024-07-10 15:20:42 +01:00
parent 7cba360e42
commit a58091b76a
2 changed files with 24 additions and 1 deletions

View File

@ -37,7 +37,18 @@ const App = () => {
<Route path="/" element={<Navigate to={user ? "/dashboard" : "/login"} />} /> <Route path="/" element={<Navigate to={user ? "/dashboard" : "/login"} />} />
<Route path="*" element={<NotFoundPage />} /> <Route path="*" element={<NotFoundPage />} />
</Routes> </Routes>
<ToastContainer /> <ToastContainer
position="top-center"
autoClose={2500}
hideProgressBar={false}
newestOnTop={false}
closeOnClick
rtl={false}
pauseOnFocusLoss
draggable
pauseOnHover
theme="colored"
/>
</div> </div>
</Router> </Router>
); );

View File

@ -1,4 +1,5 @@
import { getAuth } from 'firebase/auth'; import { getAuth } from 'firebase/auth';
import {Bounce, toast} from "react-toastify";
const apiUrl: string = 'https://www.servii.fr/api'; const apiUrl: string = 'https://www.servii.fr/api';
@ -68,6 +69,17 @@ class serviiApi {
} }
return { return_code: status, message: json }; return { return_code: status, message: json };
} }
toast.info(json.message, {
position: "top-center",
autoClose: 2500,
hideProgressBar: false,
closeOnClick: true,
pauseOnHover: true,
draggable: true,
progress: undefined,
theme: "colored",
transition: Bounce,
});
return { return_code: status, message: json.message }; return { return_code: status, message: json.message };
} }