diff --git a/src/App.tsx b/src/App.tsx
index 529ad2b..9fa0e6e 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -302,6 +302,8 @@ function App() {
sendEmail={sendEmail}
joinConference={joinConference}
authenticated={authenticated}
+ conferenceNumber={conferenceNumber}
+ participantNumber={participantsNumber}
/>
}
/>
diff --git a/src/pages/home/AuthModal.tsx b/src/pages/home/AuthModal.tsx
index 49bc896..23ebd9e 100644
--- a/src/pages/home/AuthModal.tsx
+++ b/src/pages/home/AuthModal.tsx
@@ -4,10 +4,8 @@ import { Input } from '@codegouvfr/react-dsfr/Input';
import { Checkbox } from '@codegouvfr/react-dsfr/Checkbox';
import { Badge } from '@codegouvfr/react-dsfr/Badge';
import CalendarModalComponent from './CalendarModal';
-import api from '../../axios/axios';
import { useState, useEffect } from 'react';
-import { redirect, useNavigate } from 'react-router-dom';
import styles from './AuthModal.module.css';
@@ -28,6 +26,7 @@ interface AuthModalProps {
authenticated: boolean | null;
setOpen: (e: boolean) => void;
buttons: boolean;
+ openModal: boolean;
}
function roomNameConstraintOk(roomName: string) {
@@ -54,50 +53,9 @@ export default function AuthModal(props: AuthModalProps) {
props.setOpen(true);
};
- const navigate = useNavigate();
-
- function handle() {
- 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);
- }
- });
- });
- }
- }
+ useEffect(() => {
+ props.openModal ? modal.open() : null;
+ }, [props.openModal]);
useEffect(() => {
props.setIsWhitelisted(null);
@@ -118,9 +76,14 @@ export default function AuthModal(props: AuthModalProps) {
}, []);
const agentConnect = (room: string) => {
- fetch(`${import.meta.env.VITE_BASE_URL}/authentication/login_authorize?room=${room}`, {
- redirect: 'manual',
- }).then(res => {
+ fetch(
+ `${
+ import.meta.env.VITE_BASE_URL
+ }/authentication/login_authorize?room=${room}`,
+ {
+ redirect: 'manual',
+ }
+ ).then(res => {
if (res.type === 'opaqueredirect') {
window.location.href = res.url;
} else {
@@ -222,7 +185,12 @@ export default function AuthModal(props: AuthModalProps) {
) : null}
-