mirror of
https://github.com/hubHarmony/servii-frontend.git
synced 2024-11-17 21:40:30 +00:00
[+] Enhanced toasts
Toasts now have the correct type, and are more discreet
This commit is contained in:
commit
810d190f31
@ -38,8 +38,8 @@ const App = () => {
|
|||||||
<Route path="*" element={<NotFoundPage />} />
|
<Route path="*" element={<NotFoundPage />} />
|
||||||
</Routes>
|
</Routes>
|
||||||
<ToastContainer
|
<ToastContainer
|
||||||
position="top-center"
|
position="top-right"
|
||||||
autoClose={2500}
|
autoClose={3500}
|
||||||
hideProgressBar={false}
|
hideProgressBar={false}
|
||||||
newestOnTop={false}
|
newestOnTop={false}
|
||||||
closeOnClick
|
closeOnClick
|
||||||
@ -47,7 +47,7 @@ const App = () => {
|
|||||||
pauseOnFocusLoss
|
pauseOnFocusLoss
|
||||||
draggable
|
draggable
|
||||||
pauseOnHover
|
pauseOnHover
|
||||||
theme="colored"
|
theme="light"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</Router>
|
</Router>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { getAuth } from 'firebase/auth';
|
import { getAuth } from 'firebase/auth';
|
||||||
import {Bounce, toast} from "react-toastify";
|
import { Bounce, toast } from "react-toastify";
|
||||||
|
|
||||||
const apiUrl: string = 'https://www.servii.fr/api';
|
const apiUrl: string = 'https://www.servii.fr/api';
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ enum serviiRequest {
|
|||||||
accountDelete = 'AccountDelete',
|
accountDelete = 'AccountDelete',
|
||||||
serverRun = 'ServerRun',
|
serverRun = 'ServerRun',
|
||||||
serverStop = 'ServerStop',
|
serverStop = 'ServerStop',
|
||||||
updateProperty = 'UpdateProperties',
|
updateProperty = 'UpdateProperties',
|
||||||
command = 'Command',
|
command = 'Command',
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,17 +69,30 @@ class serviiApi {
|
|||||||
}
|
}
|
||||||
return { return_code: status, message: json };
|
return { return_code: status, message: json };
|
||||||
}
|
}
|
||||||
toast.info(json.message, {
|
|
||||||
position: "top-center",
|
let toastType: 'success' | 'error' | 'info';
|
||||||
autoClose: 2500,
|
let toastColor: string;
|
||||||
|
|
||||||
|
if (status >= 200 && status < 300) {
|
||||||
|
toastType = 'success';
|
||||||
|
} else if (status >= 400 && status < 600) {
|
||||||
|
toastType = 'error';
|
||||||
|
} else {
|
||||||
|
toastType = 'info';
|
||||||
|
}
|
||||||
|
|
||||||
|
toast[toastType](json.message, {
|
||||||
|
position: "top-right",
|
||||||
|
autoClose: 3500,
|
||||||
hideProgressBar: false,
|
hideProgressBar: false,
|
||||||
closeOnClick: true,
|
closeOnClick: true,
|
||||||
pauseOnHover: true,
|
pauseOnHover: true,
|
||||||
draggable: true,
|
draggable: true,
|
||||||
progress: undefined,
|
progress: undefined,
|
||||||
theme: "colored",
|
theme: "light",
|
||||||
transition: Bounce,
|
transition: Bounce,
|
||||||
});
|
});
|
||||||
|
|
||||||
return { return_code: status, message: json.message };
|
return { return_code: status, message: json.message };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user