@ -15,6 +15,7 @@ export function useAuthNavigation() {
|
|||||||
|
|
||||||
// Subscribe to the auth state of the app and navigate accordingly.
|
// Subscribe to the auth state of the app and navigate accordingly.
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
console.log('authState', authState.value)
|
||||||
if (
|
if (
|
||||||
authState.matches('loggedIn') &&
|
authState.matches('loggedIn') &&
|
||||||
location.pathname.includes(PATHS.SIGN_IN)
|
location.pathname.includes(PATHS.SIGN_IN)
|
||||||
@ -26,5 +27,5 @@ export function useAuthNavigation() {
|
|||||||
) {
|
) {
|
||||||
navigate(PATHS.SIGN_IN)
|
navigate(PATHS.SIGN_IN)
|
||||||
}
|
}
|
||||||
}, [authState])
|
}, [authState, location.pathname])
|
||||||
}
|
}
|
||||||
|
|||||||
@ -76,6 +76,11 @@ const SignIn = () => {
|
|||||||
authActor.send({ type: 'Log in', token })
|
authActor.send({ type: 'Log in', token })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const cancelSignIn = async () => {
|
||||||
|
authActor.send({ type: 'Log out' })
|
||||||
|
setUserCode('')
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<main
|
<main
|
||||||
className="bg-primary h-screen grid place-items-stretch m-0 p-2"
|
className="bg-primary h-screen grid place-items-stretch m-0 p-2"
|
||||||
@ -141,6 +146,17 @@ const SignIn = () => {
|
|||||||
</span>
|
</span>
|
||||||
))}
|
))}
|
||||||
</p>
|
</p>
|
||||||
|
<button
|
||||||
|
onClick={toSync(cancelSignIn, reportRejection)}
|
||||||
|
className={
|
||||||
|
'm-0 mt-8 w-fit flex gap-4 items-center px-3 py-1 ' +
|
||||||
|
'!border-transparent !text-lg !text-chalkboard-10 !bg-primary hover:hue-rotate-15'
|
||||||
|
}
|
||||||
|
data-testid="cancel-sign-in-button"
|
||||||
|
>
|
||||||
|
<CustomIcon name="arrowLeft" className="w-6 h-6" />
|
||||||
|
Cancel
|
||||||
|
</button>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user