Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

fix useWorkspace

Steven Teya7a51f047358
diff --git a/apps/web/lib/swr/use-workspaces.ts b/apps/web/lib/swr/use-workspaces.ts
index e27ed179d2..8304a49c91 100644
--- a/apps/web/lib/swr/use-workspaces.ts
+++ b/apps/web/lib/swr/use-workspaces.ts
@@ -1,10 +1,12 @@
import { WorkspaceProps } from "@/lib/types";
import { fetcher } from "@dub/utils";
+import { useSession } from "next-auth/react";
import useSWR from "swr";
export default function useWorkspaces() {
+ const { data: session } = useSession();
const { data: workspaces, error } = useSWR<WorkspaceProps[]>(
- "/api/workspaces",
+ session?.user && "/api/workspaces",
fetcher,
{
dedupingInterval: 60000,