sweet alert error handling
This commit is contained in:
@ -20,6 +20,11 @@ import { selectIsLoading } from '../../redux/loaderSlice';
|
||||
import { Redirect, Link } from 'react-router-dom';
|
||||
import { Loader } from '../Loader/Loader'
|
||||
|
||||
import { withSwalInstance } from 'sweetalert2-react';
|
||||
import swal from 'sweetalert2';
|
||||
|
||||
const SweetAlert = withSwalInstance(swal);
|
||||
|
||||
const AuthForDevelopers = () => {
|
||||
const dispatch = useDispatch()
|
||||
const isAuth = useSelector(selectAuth)
|
||||
@ -68,8 +73,15 @@ const AuthForDevelopers = () => {
|
||||
onChange={(e) => setPassword(e.target.value)}
|
||||
/>
|
||||
|
||||
|
||||
|
||||
{ error && <div className={style.form__error}>
|
||||
{error}
|
||||
<SweetAlert
|
||||
show={!!error}
|
||||
title="Ошибка"
|
||||
text={error}
|
||||
onConfirm={() => setError(null)}
|
||||
/>
|
||||
</div> }
|
||||
|
||||
<div className={style.form__buttons}>
|
||||
@ -86,7 +98,7 @@ const AuthForDevelopers = () => {
|
||||
dispatch(loading(false))
|
||||
},
|
||||
catchError: () => {
|
||||
setError('Некорректные данные')
|
||||
setError('Некорректные данные для входа')
|
||||
dispatch(loading(false))
|
||||
}
|
||||
})
|
||||
|
@ -192,12 +192,11 @@
|
||||
color: #6aaf5c !important;
|
||||
}
|
||||
|
||||
.form__error {
|
||||
/* .form__error {
|
||||
font-size: 16px;
|
||||
color: #b21;
|
||||
margin-left: 45px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
} */
|
||||
|
||||
@media (max-width: 575.98px) {
|
||||
.form__btn {
|
||||
|
@ -21,6 +21,11 @@ import { selectIsLoading } from '../../redux/loaderSlice';
|
||||
import { Redirect, Link } from 'react-router-dom';
|
||||
import { Loader } from '../Loader/Loader'
|
||||
|
||||
import { withSwalInstance } from 'sweetalert2-react';
|
||||
import swal from 'sweetalert2';
|
||||
|
||||
const SweetAlert = withSwalInstance(swal);
|
||||
|
||||
const AuthForPartners = () => {
|
||||
const dispatch = useDispatch()
|
||||
const isAuth = useSelector(selectAuth)
|
||||
@ -64,7 +69,12 @@ const AuthForPartners = () => {
|
||||
/>
|
||||
|
||||
{ error && <div className={style.form__error}>
|
||||
{error}
|
||||
<SweetAlert
|
||||
show={!!error}
|
||||
title="Ошибка"
|
||||
text={error}
|
||||
onConfirm={() => setError(null)}
|
||||
/>
|
||||
</div> }
|
||||
|
||||
<div className={style.form__buttons}>
|
||||
@ -81,7 +91,7 @@ const AuthForPartners = () => {
|
||||
dispatch(loading(false))
|
||||
},
|
||||
catchError: () => {
|
||||
setError('Некорректные данные')
|
||||
setError('Некорректные данные для входа')
|
||||
dispatch(loading(false))
|
||||
}
|
||||
})
|
||||
|
@ -189,12 +189,11 @@
|
||||
color: #6aaf5c !important;
|
||||
}
|
||||
|
||||
.form__error {
|
||||
/* .form__error {
|
||||
font-size: 16px;
|
||||
color: #b21;
|
||||
margin-left: 45px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
} */
|
||||
|
||||
@media (max-width: 575.98px) {
|
||||
.form__btn {
|
||||
|
Reference in New Issue
Block a user