Check if router is ready (#17)
This commit is contained in:
parent
1129e3e022
commit
0a5069ba7f
@ -6,6 +6,7 @@ import { useEffect, useRef, useState } from 'react';
|
||||
export default function Login() {
|
||||
const router = useRouter();
|
||||
const { id, audience, acsUrl, providerName, relayState } = router.query;
|
||||
const isRouteReady = router.isReady;
|
||||
|
||||
const [state, setState] = useState({
|
||||
username: 'jackson',
|
||||
@ -25,7 +26,7 @@ export default function Login() {
|
||||
acsUrlInp.current.focus();
|
||||
acsUrlInp.current.select();
|
||||
}
|
||||
}, []);
|
||||
}, [acsUrl]);
|
||||
|
||||
const handleChange = (e: FormEvent<HTMLInputElement | HTMLSelectElement>): void => {
|
||||
const { name, value } = e.currentTarget;
|
||||
@ -75,7 +76,8 @@ export default function Login() {
|
||||
<div className='relative top-20 mx-auto w-[465px] max-w-[90%] rounded-md border p-10 text-[#145698]'>
|
||||
<h2 className='mb-3 text-center text-3xl font-bold'>Login</h2>
|
||||
<form onSubmit={handleSubmit}>
|
||||
{acsUrl ? null : (
|
||||
{isRouteReady ? (
|
||||
acsUrl ? null : (
|
||||
<div>
|
||||
<div className='mt-5'>
|
||||
<label htmlFor='acsUrl' className='mb-2 block'>
|
||||
@ -109,7 +111,8 @@ export default function Login() {
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
)
|
||||
) : null}
|
||||
<div className='mt-5 flex items-end gap-x-1'>
|
||||
<div>
|
||||
<label htmlFor='username' className='mb-2 block'>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user