mirror of
https://github.com/Ravinou/borgwarehouse
synced 2024-05-20 14:36:39 +02:00
refactor: toast notification for settings
This commit is contained in:
parent
c9e13316e2
commit
dd3956c6bb
|
@ -1,5 +1,5 @@
|
|||
//Lib
|
||||
import { ToastContainer, toast } from 'react-toastify';
|
||||
import { toast } from 'react-toastify';
|
||||
import 'react-toastify/dist/ReactToastify.css';
|
||||
import classes from '../UserSettings.module.css';
|
||||
import { useState } from 'react';
|
||||
|
@ -25,7 +25,6 @@ export default function EmailSettings(props) {
|
|||
const {
|
||||
register,
|
||||
handleSubmit,
|
||||
control,
|
||||
reset,
|
||||
formState: { errors, isSubmitting, isValid },
|
||||
} = useForm({ mode: 'onChange' });
|
||||
|
@ -61,15 +60,7 @@ export default function EmailSettings(props) {
|
|||
reset();
|
||||
setIsLoading(false);
|
||||
setInfo(true);
|
||||
toast.success('Email edited !', {
|
||||
position: 'top-right',
|
||||
autoClose: 5000,
|
||||
hideProgressBar: false,
|
||||
closeOnClick: true,
|
||||
pauseOnHover: true,
|
||||
draggable: true,
|
||||
progress: undefined,
|
||||
});
|
||||
toast.success('Email edited !', toastOptions);
|
||||
}
|
||||
};
|
||||
return (
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//Lib
|
||||
import { ToastContainer, toast } from 'react-toastify';
|
||||
import { toast } from 'react-toastify';
|
||||
import 'react-toastify/dist/ReactToastify.css';
|
||||
import classes from '../UserSettings.module.css';
|
||||
import { useState } from 'react';
|
||||
|
@ -13,7 +13,7 @@ export default function PasswordSettings(props) {
|
|||
//Var
|
||||
const toastOptions = {
|
||||
position: 'top-right',
|
||||
autoClose: 8000,
|
||||
autoClose: 5000,
|
||||
hideProgressBar: false,
|
||||
closeOnClick: true,
|
||||
pauseOnHover: true,
|
||||
|
@ -24,7 +24,6 @@ export default function PasswordSettings(props) {
|
|||
const {
|
||||
register,
|
||||
handleSubmit,
|
||||
control,
|
||||
reset,
|
||||
formState: { errors, isSubmitting, isValid },
|
||||
} = useForm({ mode: 'onChange' });
|
||||
|
@ -60,15 +59,7 @@ export default function PasswordSettings(props) {
|
|||
} else {
|
||||
reset();
|
||||
setIsLoading(false);
|
||||
toast.success('🔑 Password edited !', {
|
||||
position: 'top-right',
|
||||
autoClose: 5000,
|
||||
hideProgressBar: false,
|
||||
closeOnClick: true,
|
||||
pauseOnHover: true,
|
||||
draggable: true,
|
||||
progress: undefined,
|
||||
});
|
||||
toast.success('🔑 Password edited !', toastOptions);
|
||||
}
|
||||
};
|
||||
return (
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//Lib
|
||||
import { ToastContainer, toast } from 'react-toastify';
|
||||
import { toast } from 'react-toastify';
|
||||
import 'react-toastify/dist/ReactToastify.css';
|
||||
import classes from '../UserSettings.module.css';
|
||||
import { useState } from 'react';
|
||||
|
@ -25,7 +25,6 @@ export default function UsernameSettings(props) {
|
|||
const {
|
||||
register,
|
||||
handleSubmit,
|
||||
control,
|
||||
reset,
|
||||
formState: { errors, isSubmitting, isValid },
|
||||
} = useForm({ mode: 'onChange' });
|
||||
|
@ -61,15 +60,7 @@ export default function UsernameSettings(props) {
|
|||
reset();
|
||||
setIsLoading(false);
|
||||
setInfo(true);
|
||||
toast.success('Username edited !', {
|
||||
position: 'top-right',
|
||||
autoClose: 5000,
|
||||
hideProgressBar: false,
|
||||
closeOnClick: true,
|
||||
pauseOnHover: true,
|
||||
draggable: true,
|
||||
progress: undefined,
|
||||
});
|
||||
toast.success('Username edited !', toastOptions);
|
||||
}
|
||||
};
|
||||
return (
|
||||
|
|
Loading…
Reference in a new issue