Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

fix: Required user type in layout

Richie McIlroy3ee2c1528b2a
diff --git a/apps/web/app/dashboard/_components/DynamicSharedLayout.tsx b/apps/web/app/dashboard/_components/DynamicSharedLayout.tsx
index 883e2eb6e..3d25ae093 100644
--- a/apps/web/app/dashboard/_components/DynamicSharedLayout.tsx
+++ b/apps/web/app/dashboard/_components/DynamicSharedLayout.tsx
@@ -19,7 +19,7 @@ import { isUserOnProPlan } from "@cap/utils";
type SharedContext = {
spaceData: (typeof spaces.$inferSelect)[] | null;
activeSpace: typeof spaces.$inferSelect | null;
- user: typeof users.$inferSelect | null;
+ user: typeof users.$inferSelect;
};
const Context = createContext<SharedContext>({} as SharedContext);
diff --git a/apps/web/app/dashboard/layout.tsx b/apps/web/app/dashboard/layout.tsx
index a181ac620..859e28fdd 100644
--- a/apps/web/app/dashboard/layout.tsx
+++ b/apps/web/app/dashboard/layout.tsx
@@ -14,7 +14,7 @@ export default async function DashboardLayout({
}) {
const user = await getCurrentUser();
- if (!user) {
+ if (!user || !user.id) {
redirect("/login");
}