chore: release 0.0.1
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { redirect } from "next/navigation";
|
||||
import { createSupabaseServerClient } from "@/lib/supabase/server";
|
||||
import { ensureDefaultWorkspace, resolveActiveWorkspaceId } from "@/lib/workspaces";
|
||||
|
||||
export default async function Home() {
|
||||
const supabase = await createSupabaseServerClient();
|
||||
@@ -11,10 +12,18 @@ export default async function Home() {
|
||||
redirect("/login");
|
||||
}
|
||||
|
||||
await ensureDefaultWorkspace(supabase, session.user.id, session.user.email ?? "我的空间");
|
||||
const workspaceId = await resolveActiveWorkspaceId(supabase, session.user.id);
|
||||
|
||||
if (!workspaceId) {
|
||||
redirect("/login");
|
||||
}
|
||||
|
||||
const { data: firstDoc } = await supabase
|
||||
.from("documents")
|
||||
.select("id")
|
||||
.eq("user_id", session.user.id)
|
||||
.eq("workspace_id", workspaceId)
|
||||
.order("created_at", { ascending: true })
|
||||
.limit(1)
|
||||
.maybeSingle();
|
||||
@@ -27,6 +36,7 @@ export default async function Home() {
|
||||
.from("documents")
|
||||
.insert({
|
||||
user_id: session.user.id,
|
||||
workspace_id: workspaceId,
|
||||
title: "新页面",
|
||||
content: {},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user