I'm having a simple issue that I can't seem to figure out. Whenever I type /login in the URL, I want to stay on the homepage instead of being redirected to /pages/login (which currently gives a 404 error). I also need to keep it as a GET parameter to toggle my LoginModal.
import Link from 'next/link'
// components/Header.js
<Link href="/?login" as="/login">
<LoginButton />
</Link>
// components/Auth.js
const Auth = () => {
const router = useRouter()
return (
<>
{ 'login' in router.query && <LoginModal />}
{ 'register' in router.query && <RegisterModal />}
</>
)
}
// pages/index.js
const Index = () => {
return (
<>
<Header />
<HomePage />
<Auth />
</>
)
}
// pages/login.js doesn't exist
Any help would be appreciated. Thank you!