From 0684e4c3a6cf2d9c49d025bd383fb9bb9c2526ed Mon Sep 17 00:00:00 2001 From: "youssef.el-mkhantar" Date: Fri, 12 Jan 2024 15:45:22 +0100 Subject: [PATCH] auth fix --- .env | 2 +- src/App.tsx | 8 +++++--- src/components/header/Header.tsx | 2 +- src/pages/home/AuthModal.tsx | 2 +- src/pages/login/LoginCallback.tsx | 2 +- src/pages/login/LogoutCallback.tsx | 2 +- 6 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.env b/.env index 0e7cbe4..4e0d074 100644 --- a/.env +++ b/.env @@ -1,4 +1,4 @@ -VITE_BASE_URL='https://wce-portail.local/backend' +VITE_BASE_URL='https://wce-portail.local/wce-api' VITE_JITSI_DOMAIN='appel.preprod.webconf.numerique.gouv.fr' VITE_VOXAPI_URL='https://preprod.webconf.numerique.gouv.fr/voxapi/apiconf' GENERATE_SOURCEMAP=false \ No newline at end of file diff --git a/src/App.tsx b/src/App.tsx index 5c83d82..1caea9e 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -192,9 +192,11 @@ function App() { setMsg={setMsg} setRoomName={setRoomName} />; - } else { - return ; - } + } + // else { + // return ; + // } + return <> }; const OtherRoutes = () => { diff --git a/src/components/header/Header.tsx b/src/components/header/Header.tsx index 725f2c4..1064e48 100644 --- a/src/components/header/Header.tsx +++ b/src/components/header/Header.tsx @@ -26,7 +26,7 @@ function HeaderComponent({ const logOut = () => { api - .get('/logout') + .get('/auth/logout') .then(res => { if (res.data.error) { localStorage.setItem('auth', 'false'); diff --git a/src/pages/home/AuthModal.tsx b/src/pages/home/AuthModal.tsx index 94f88e7..ec69159 100644 --- a/src/pages/home/AuthModal.tsx +++ b/src/pages/home/AuthModal.tsx @@ -118,7 +118,7 @@ export default function AuthModal(props: AuthModalProps) { }, []); const agentConnect = (room: string) => { - fetch(`${import.meta.env.VITE_BASE_URL}/login_authorize?room=${room}`, { + fetch(`${import.meta.env.VITE_BASE_URL}/auth/login_authorize?room=${room}`, { redirect: 'manual', }).then(res => { if (res.type === 'opaqueredirect') { diff --git a/src/pages/login/LoginCallback.tsx b/src/pages/login/LoginCallback.tsx index 28410af..7d2b5c9 100644 --- a/src/pages/login/LoginCallback.tsx +++ b/src/pages/login/LoginCallback.tsx @@ -26,7 +26,7 @@ export default function LoginCallback({ } api .get( - `/login_callback?code=${urlParams.get('code')}&state=${urlParams.get( + `/auth/login_callback?code=${urlParams.get('code')}&state=${urlParams.get( 'state' )}` ) diff --git a/src/pages/login/LogoutCallback.tsx b/src/pages/login/LogoutCallback.tsx index 9411c1e..7f5a711 100644 --- a/src/pages/login/LogoutCallback.tsx +++ b/src/pages/login/LogoutCallback.tsx @@ -22,7 +22,7 @@ export default function LogoutCallback({ useEffect(() => { api - .get(`/logout_callback?state=${urlParams.get('state')}`) + .get(`/auth/logout_callback?state=${urlParams.get('state')}`) .then(res => { setAuthenticated(false); localStorage.setItem('auth', 'false');