Skip to content

Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.

fix: request to api/teams when user is not logged in

Aashish-Upadhyay-101dc1e618b4ae4
diff --git a/lib/swr/use-teams.ts b/lib/swr/use-teams.ts
index 100a985c..e0ed79c9 100644
--- a/lib/swr/use-teams.ts
+++ b/lib/swr/use-teams.ts
@@ -2,12 +2,14 @@ import { useRouter } from "next/router";
import useSWR from "swr";
import { fetcher } from "@/lib/utils";
import { Team } from "@/lib/types";
+import { useSession } from "next-auth/react";
export function useTeams() {
const router = useRouter();
+ const { data: session } = useSession();
const { data: teams, isValidating } = useSWR<Team[]>(
- router.isReady && "/api/teams",
+ router.isReady && session ? "/api/teams" : [],
fetcher,
{
dedupingInterval: 20000,