Add verify auth check to settings
This commit is contained in:
@ -12,6 +12,7 @@ import { DEFAULT_HEADER_HEIGHT } from './homeFeed/HeaderSpacer'
|
||||
import { logout } from '../../lib/logout'
|
||||
import { SettingsMenu } from './navMenu/SettingsMenu'
|
||||
import { SettingsDropdown } from './navMenu/SettingsDropdown'
|
||||
import { useVerifyAuth } from '../../lib/hooks/useVerifyAuth'
|
||||
|
||||
type SettingsLayoutProps = {
|
||||
title?: string
|
||||
@ -19,7 +20,8 @@ type SettingsLayoutProps = {
|
||||
}
|
||||
|
||||
export function SettingsLayout(props: SettingsLayoutProps): JSX.Element {
|
||||
const { viewerData } = useGetViewerQuery()
|
||||
useVerifyAuth()
|
||||
|
||||
const router = useRouter()
|
||||
const [showLogoutConfirmation, setShowLogoutConfirmation] = useState(false)
|
||||
const [showKeyboardCommandsModal, setShowKeyboardCommandsModal] =
|
||||
|
||||
@ -5,8 +5,8 @@ export function useVerifyAuth() {
|
||||
const router = useRouter()
|
||||
|
||||
useEffect(() => {
|
||||
if (window.localStorage.getItem('authVerified')) {
|
||||
console.log('not verified')
|
||||
if (!window.localStorage.getItem('authVerified')) {
|
||||
window.location.href = `/login?redirect=${window.location.pathname}`
|
||||
return
|
||||
}
|
||||
}, [router])
|
||||
|
||||
Reference in New Issue
Block a user