logout fixes with role redirect

This commit is contained in:
kurpfish
2021-08-20 17:33:29 +03:00
parent 8cce68ce06
commit 7891dccb59
14 changed files with 89 additions and 29 deletions

View File

@ -8,10 +8,14 @@ import './form.css';
import { withSwalInstance } from 'sweetalert2-react';
import swal from 'sweetalert2';
import { useSelector } from 'react-redux';
import { getRole } from '../../redux/roleSlice';
const SweetAlert = withSwalInstance(swal);
const Form = () => {
const history = useHistory();
const role = useSelector(getRole);
const urlParams = useParams();
const [status, setStatus] = useState(null);
const [data, setData] = useState({
@ -20,8 +24,6 @@ const Form = () => {
comment: '',
});
const history = useHistory();
const handleChange = (e) => {
const { id, value } = e.target;
@ -40,10 +42,10 @@ const Form = () => {
formData.append('phone', data.phone);
formData.append('comment', data.comment);
fetchForm(`${process.env.REACT_APP_API_URL}/api/profile/add-to-interview`, {
fetchForm({ link: `${process.env.REACT_APP_API_URL}/api/profile/add-to-interview`, index: {
profile_id: urlParams.id,
...data,
}).then( (res)=> res.json()
}, history, role }).then( (res)=> res.json()
.then( resJSON => setStatus(resJSON))
)
};