Skip to content

Commit

Permalink
Merge pull request #85 from anct-cnum/sq/fixSuppressionCandidature
Browse files Browse the repository at this point in the history
Corrections de bugs candidature
  • Loading branch information
squirrion authored Oct 18, 2023
2 parents f803acc + 2903baf commit e9da737
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
4 changes: 1 addition & 3 deletions src/actions/conseiller.actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,12 @@ function resetCVFile() {
function deleteCandidature(motif, conseiller, username, password) {
return dispatch => {
dispatch(request());

userService.login(username, password).then(
() => {
conseillerService.deleteCandidature(motif, conseiller).then(
data => {
dispatch(success(data));
history.push('/candidature-supprimee');
window.location.pathname = '/candidature-supprimee';
},
error => {
dispatch(failure(error));
Expand All @@ -148,7 +147,6 @@ function deleteCandidature(motif, conseiller, username, password) {
},
error => {
dispatch(failure(error.error));
history.push('/login');
}
);

Expand Down
2 changes: 1 addition & 1 deletion src/assets/css/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ $blue-france:#000091;
font-size: 1rem;
cursor: pointer;
&:hover {
background-color: #d30000;
background-color: #d30000 !important;
}
}
.desactiver-btn {
Expand Down
2 changes: 1 addition & 1 deletion src/components/anonymous/Login.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function Login() {

function handleChange(e) {
const { name, value } = e.target;
setInputs(inputs => ({ ...inputs, [name]: value }));
setInputs(inputs => ({ ...inputs, [name]: value.trim() }));
}

function handleSubmit() {
Expand Down
9 changes: 8 additions & 1 deletion src/components/connected/SupprimerCandidature.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ function SupprimerCandidature({ conseiller }) {
const [displaySupprimerCandidatureForm, setDisplaySupprimerCandidatureForm] = useState(false);
const [autre, setAutre] = useState(false);
const [active, setActive] = useState(false);
const [clickDisabled, setClickDisabled] = useState(false);
const [inputs, setInputs] = useState({
motif: '',
password: '',
Expand Down Expand Up @@ -148,7 +149,13 @@ function SupprimerCandidature({ conseiller }) {
setActive(false);
} }>Annuler</button>
<button className={active ? 'red-btn fr-col-offset-2 fr-col-5 ' : 'desactiver-btn fr-col-offset-2 fr-col-5'}
disabled={!active} onClick={handleSubmit}>
style={clickDisabled ? { cursor: 'not-allowed' } : {}}
disabled={!active || clickDisabled} onClick={e => {
if (e.detail === 1 && !clickDisabled) {
setClickDisabled(true);
handleSubmit();
}
}}>
Supprimer mes informations
</button>
</div>
Expand Down

0 comments on commit e9da737

Please sign in to comment.