♻️(frontend) refactor hardcoded '/authenticate' API calls
Use the function introduce by @manuhabitela, authUrl. It reduces code duplication.
This commit is contained in:
committed by
aleb_the_flash
parent
c390499394
commit
3718851435
@@ -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 = () => {
|
||||
</Text>
|
||||
</div>
|
||||
<div>
|
||||
{isLoggedIn === false && <A href={apiUrl('/authenticate')}>Login</A>}
|
||||
{isLoggedIn === false && <A href={authUrl()}>Login</A>}
|
||||
{!!user && (
|
||||
<p className={flex({ gap: 1, align: 'center' })}>
|
||||
<Badge>{user.email}</Badge>
|
||||
|
||||
@@ -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 = () => {
|
||||
</Button>
|
||||
) : (
|
||||
<p>
|
||||
<A href={apiUrl('/authenticate')}>
|
||||
<A href={authUrl()}>
|
||||
Login to create a conference call
|
||||
</A>
|
||||
</p>
|
||||
|
||||
Reference in New Issue
Block a user