From 3718851435762a5c5ef204941904c4b3655198db Mon Sep 17 00:00:00 2001 From: lebaudantoine Date: Wed, 17 Jul 2024 16:16:41 +0200 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F(frontend)=20refactor=20hardc?= =?UTF-8?q?oded=20'/authenticate'=20API=20calls?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use the function introduce by @manuhabitela, authUrl. It reduces code duplication. --- src/frontend/src/layout/Header.tsx | 4 ++-- src/frontend/src/routes/Home.tsx | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/frontend/src/layout/Header.tsx b/src/frontend/src/layout/Header.tsx index 338aba67..09b65e38 100644 --- a/src/frontend/src/layout/Header.tsx +++ b/src/frontend/src/layout/Header.tsx @@ -2,7 +2,7 @@ import { css } from '@/styled-system/css' import { flex } from '@/styled-system/patterns' import { apiUrl } from '@/api/apiUrl' import { A, Badge, Text } from '@/primitives' -import { useUser } from '@/features/auth/api/useUser' +import { authUrl, useUser } from '@/features/auth' export const Header = () => { const { user, isLoggedIn } = useUser() @@ -31,7 +31,7 @@ export const Header = () => {
- {isLoggedIn === false && Login} + {isLoggedIn === false && Login} {!!user && (

{user.email} diff --git a/src/frontend/src/routes/Home.tsx b/src/frontend/src/routes/Home.tsx index 4118235a..da1a35ca 100644 --- a/src/frontend/src/routes/Home.tsx +++ b/src/frontend/src/routes/Home.tsx @@ -1,6 +1,5 @@ import { A, Button, Italic, P, Div, H, Box } from '@/primitives' -import { useUser } from '@/features/auth' -import { apiUrl } from '@/api/apiUrl' +import { authUrl, useUser } from '@/features/auth' import { navigateToNewRoom } from '@/features/rooms' import { Screen } from '@/layout/Screen' @@ -19,7 +18,7 @@ export const Home = () => { ) : (

- + Login to create a conference call