Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/DISIC/wce-portail into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
youssef.el-mkhantar committed Mar 26, 2024
2 parents 3d24ba9 + a306054 commit 8ff0c17
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 1 deletion.
55 changes: 55 additions & 0 deletions src/pages/home/AuthModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,57 @@ export default function AuthModal(props: AuthModalProps) {
props.setOpen(true);
};

<<<<<<< HEAD
useEffect(() => {
props.openModal ? modal.open() : null;
}, [props.openModal]);
=======
const navigate = useNavigate();

function handle(e: any) {
e.preventDefault();
if (!props.roomName) {
const room = generateRoomName();
props.setRoomName(room);
if (roomNameConstraintOk(room)) {
api.get('/authentication/whereami').then(res => {
if (res.data.toLowerCase() == 'internet') {
if (!props.authenticated) {
modal.open();
}
if (props.authenticated) {
props.joinConference(room);
}
}
if (res.data.toLowerCase() !== 'internet') {
props.joinConference(room);
}
});
}
} else if (roomNameConstraintOk(props.roomName)) {
api
.get('/roomExists/' + props.roomName)
.then(res => {
return navigate('/' + props.roomName);
})
.catch(err => {
api.get('/authentication/whereami').then(res => {
if (res.data.toLowerCase() == 'internet') {
if (!props.authenticated) {
return modal.open();
}
if (props.authenticated) {
return props.joinConference(props.roomName);
}
}
if (res.data.toLowerCase() !== 'internet') {
return props.joinConference(props.roomName);
}
});
});
}
}
>>>>>>> a306054b2c0e02f9d605371837dbce6a817ff84f

useEffect(() => {
props.setIsWhitelisted(null);
Expand Down Expand Up @@ -186,10 +234,17 @@ export default function AuthModal(props: AuthModalProps) {
</modal.Component>
<div className={styles.buttons}>
<Button
<<<<<<< HEAD
// onClick={handle}
type="submit"
className={styles.button}
disabled={!roomNameConstraintOk(props.roomName)}
=======
onClick={handle}
className={styles.button}
disabled={!roomNameConstraintOk(props.roomName)}
type="submit"
>>>>>>> a306054b2c0e02f9d605371837dbce6a817ff84f
>
Rejoindre ou créer
</Button>
Expand Down
3 changes: 2 additions & 1 deletion src/pages/home/HomeForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,8 @@ function HomeForm(props: AuthModalProps) {

<Button
className={styles.plusButton}
onClick={() => {
onClick={e => {
e.preventDefault();
verifyAndSetVAlue(generateRoomName());
}}
type="button"
Expand Down

0 comments on commit 8ff0c17

Please sign in to comment.