-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ajout de la page de formulaire validé
- Loading branch information
Showing
13 changed files
with
135 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
|
||
export default function Alert({ children, titre }) { | ||
return ( | ||
<div className="fr-alert fr-alert--error"> | ||
<h3 className="fr-alert__title">{titre}</h3> | ||
<p>{children}</p> | ||
</div> | ||
); | ||
} | ||
|
||
Alert.propTypes = { | ||
children: PropTypes.node, | ||
titre: PropTypes.string, | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,34 @@ | ||
export const useApiAdmin = () => { | ||
const creerCandidatureConseiller = async () => { | ||
const creerCandidatureConseiller = async conseillerData => { | ||
const baseUrl = import.meta.env.VITE_APP_API_URL; | ||
const requestOptions = { | ||
method: 'POST', | ||
headers: { 'Content-Type': 'application/json' } | ||
headers: { 'Content-Type': 'application/json' }, | ||
body: conseillerData | ||
}; | ||
|
||
try { | ||
const result = fetch(`${baseUrl}/candidature-conseiller`, requestOptions); | ||
console.log('===================', result); | ||
return await fetch(`${baseUrl}/candidature-conseiller`, requestOptions); | ||
} catch (error) { | ||
console.error(error); | ||
return error; | ||
} | ||
}; | ||
|
||
return { creerCandidatureConseiller }; | ||
const convertStringToBoolean = (conseillerData, key) => { | ||
if (conseillerData[key] === 'on') { | ||
conseillerData[key] = true; | ||
} | ||
}; | ||
|
||
const buildConseillerData = formData => { | ||
const conseillerData = JSON.stringify(Object.fromEntries(formData)); | ||
convertStringToBoolean(conseillerData, 'demandeurEmploi'); | ||
convertStringToBoolean(conseillerData, 'enEmploi'); | ||
convertStringToBoolean(conseillerData, 'enFormation'); | ||
convertStringToBoolean(conseillerData, 'diplome'); | ||
|
||
return conseillerData; | ||
}; | ||
|
||
return { buildConseillerData, creerCandidatureConseiller }; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
.cv-contenu { | ||
width: 100%; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
} | ||
|
||
.cv-titre { | ||
color: var(--blue-france-sun-113-625); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import React from 'react'; | ||
import { useNavigate } from 'react-router-dom'; | ||
|
||
import './CandidatureValidee.css'; | ||
|
||
|
||
export default function CandidatureValidee() { | ||
const navigate = useNavigate(); | ||
|
||
const goToHome = () => { | ||
navigate('/'); | ||
}; | ||
|
||
return ( | ||
<div className="fr-container fr-p-10w cv-contenu"> | ||
<h1 className="fr-mb-5w">👏</h1> | ||
<h2 className="fr-mb-5w cv-titre">Merci, votre demande a été envoyée.</h2> | ||
<p> | ||
Pour confirmer votre inscription et recevoir des propositions de candidats, veuillez{' '} | ||
consulter l’email qui vient de vous être envoyé. Si vous ne recevez pas cet email dans les prochaines minutes,{' '} | ||
pensez à vérifier votre dossier de spams. | ||
</p> | ||
<button className="fr-btn fr-btn--secondary" onClick={goToHome}> | ||
Retour à la page d’accueil | ||
</button> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import React from 'react'; | ||
import Header from '../../components/Header'; | ||
import CandidatureValidee from './CandidatureValidee'; | ||
|
||
export default function PageCandidatureValidee() { | ||
return ( | ||
<> | ||
<Header /> | ||
<CandidatureValidee /> | ||
</> | ||
); | ||
} |