fix login redirect state error when no r param is supplied

This commit is contained in:
Chris Hills 2023-03-12 06:28:46 -05:00
parent 426fb005c8
commit ce64995e47

View file

@ -1,13 +1,14 @@
import { useSearchParams } from 'react-router-dom'
import { ReactComponent as Logo } from '../../assets/logo.svg'
import { env } from '../../config/env'
import Button from '../../ui/Button'
import './Auth.css'
export default function Login() {
const [searchParams] = useSearchParams()
const handleRedirect = () => {
const urlParams = new URLSearchParams(window.location.search)
window.location.href = `${env.api.baseURL}/auth/login?r=${urlParams.get('r')}`
window.location.href = `${env.api.baseURL}/auth/login?r=${searchParams.get('r') ?? '/'}`
}
return (