Skip to content

Commit

Permalink
feat(client): show alert if trying to see restricted content when
Browse files Browse the repository at this point in the history
unauthorized
  • Loading branch information
sripwoud committed Sep 6, 2024
1 parent f62fdac commit 5d85b4c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion client/src/hooks/useAuthorized.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ export const useAuthorized = () => {
const navigate = useNavigate()

useEffect(() => {
if (Cookies.get(config.cookie.name) !== 'true')
if (Cookies.get(config.cookie.name) !== 'true') {
// FIXME this renders twice
alert('Nice try! But we need to verify your age first (try clicking the Login button)')
navigate('/')
}
}, [navigate])

const logout = () => {
Expand Down

0 comments on commit 5d85b4c

Please sign in to comment.