import React, {useState, useEffect} from 'react'
import { useLocation, useNavigate } from 'react-router-dom'

function Redirect() {
    const location = useLocation();
    const navigate = useNavigate();

    const queryParams = new URLSearchParams(location?.search);
    const codeResponse = queryParams.get("code");

    useEffect(()=>{
        if(!codeResponse){
            navigate('/login', {replace: true})
            return
        }
        console.log(codeResponse)
    },[])
  return (
    <div>Redirecting ... </div>
  )
}

export default Redirect