omnivore/packages/web/lib/hooks/useVerifyAuth.tsx

14 lines
326 B
TypeScript
Raw Permalink Normal View History

2024-03-05 04:48:23 +00:00
import { useEffect } from 'react'
import { useRouter } from 'next/router'
export function useVerifyAuth() {
const router = useRouter()
useEffect(() => {
2024-03-05 05:16:01 +00:00
if (!window.localStorage.getItem('authVerified')) {
window.location.href = `/login?redirect=${window.location.pathname}`
2024-03-05 04:48:23 +00:00
return
}
}, [router])
}