Merge pull request #3 from Antoninop/react-toastify

[+] react-toastify integration
This commit is contained in:
Antoninop 2024-07-10 23:57:02 +02:00 committed by GitHub
commit 4e6dbd03c3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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={<NotFoundPage />} />
</Routes>
<ToastContainer />
<ToastContainer
position="top-center"
autoClose={2500}
hideProgressBar={false}
newestOnTop={false}
closeOnClick
rtl={false}
pauseOnFocusLoss
draggable
pauseOnHover
theme="colored"
/>
</div>
</Router>
);

View File

@ -1,4 +1,5 @@
import { getAuth } from 'firebase/auth';
import {Bounce, toast} from "react-toastify";
const apiUrl: string = 'https://www.servii.fr/api';
@ -68,6 +69,17 @@ class serviiApi {
}
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 };
}