diff options
author | Rohan Raj Gupta <[email protected]> | 2022-08-19 00:09:27 +0530 |
---|---|---|
committer | GitHub <[email protected]> | 2022-08-19 00:09:27 +0530 |
commit | a9ed2c9daa5a3e065401996daf922f59de7f0101 (patch) | |
tree | 4a30f638243ea220f670a16a42f2dc61779bda32 /client/src/pages/Enrollment/PhotoCapture/PhotoCapture.jsx | |
parent | 6c924aef55707885cbbf9af8348564526ac146ee (diff) | |
parent | a06eec4ebb81ba77d4a8b03372a6312ffa5b2aa0 (diff) |
Merge pull request #8 from Blaster4385/develop
moved to context api for enrollment and minor fixes
Diffstat (limited to 'client/src/pages/Enrollment/PhotoCapture/PhotoCapture.jsx')
-rw-r--r-- | client/src/pages/Enrollment/PhotoCapture/PhotoCapture.jsx | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/client/src/pages/Enrollment/PhotoCapture/PhotoCapture.jsx b/client/src/pages/Enrollment/PhotoCapture/PhotoCapture.jsx index a54085f..17fe3df 100644 --- a/client/src/pages/Enrollment/PhotoCapture/PhotoCapture.jsx +++ b/client/src/pages/Enrollment/PhotoCapture/PhotoCapture.jsx @@ -7,22 +7,23 @@ import SubmitButton from '../../../components/SubmitButton/SubmitButton' import styles from './PhotoCapture.module.css' import { Button, Grid, Typography } from '@mui/material' import { t } from 'i18next' +import { userContext } from '../../../context/User' -const PhotoCapture = ({ formData, setFormData }) => { +const PhotoCapture = () => { const navigate = useNavigate() - + const { userData, setUserData } = userContext() const webcamRef = React.useRef(null) const capture = React.useCallback(() => { const imageSrc = webcamRef.current.getScreenshot() - setFormData({ ...formData, photo: imageSrc }) + setUserData({ ...userData, photo: imageSrc }) }) return ( <> <Header subheading={t('ENROLLMENT')} /> <div className={styles.card__container}> - {formData.photo === '' ? ( + {!userData.photo ? ( <Webcam audio={false} height={400} @@ -36,7 +37,7 @@ const PhotoCapture = ({ formData, setFormData }) => { }} /> ) : ( - <img src={formData.photo} /> + <img src={userData.photo} /> )} </div> <Grid container columnSpacing={10} justifyContent="center"> @@ -62,7 +63,7 @@ const PhotoCapture = ({ formData, setFormData }) => { variant="contained" onClick={(e) => { e.preventDefault() - setFormData({ ...formData, photo: '' }) + setUserData({ ...userData, photo: '' }) }} > {t('RESET')} |