import {useEffect} from 'react' import Router from 'next/router' import useUser from './useUser' export default function useAccountRedirect(){ const user = useUser() if(user && user.is_admin) return; const err = new Error("Unauthorized") err.status = 401 throw err }