Improved it a tad bit more
This commit is contained in:
@@ -10,6 +10,7 @@ export default function useUser({redirectTo = "", redirectIfFound = false} = {})
|
||||
const {data: user, mutate: mutateUser, isLoading} = useSWR<User>("/api/user", fetcher);
|
||||
|
||||
useEffect(() => {
|
||||
console.log("HERE!!!");
|
||||
// if no redirect needed, just return (example: already on /dashboard)
|
||||
// if user data not yet there (fetch in progress, logged in or not) then don't do anything yet
|
||||
if (!redirectTo || !user) return;
|
||||
|
||||
Reference in New Issue
Block a user