Add account hierarchy framework with migrations, RLS policies, and UI components
This commit is contained in:
@@ -1,19 +1,32 @@
|
||||
import { getSupabaseServerClient } from '@kit/supabase/server-client';
|
||||
import { createSiteBuilderApi } from '@kit/site-builder/api';
|
||||
import { SiteEditor } from '@kit/site-builder/components';
|
||||
import { getSupabaseServerClient } from '@kit/supabase/server-client';
|
||||
|
||||
import { AccountNotFound } from '~/components/account-not-found';
|
||||
|
||||
interface Props { params: Promise<{ account: string; pageId: string }> }
|
||||
interface Props {
|
||||
params: Promise<{ account: string; pageId: string }>;
|
||||
}
|
||||
|
||||
export default async function EditPageRoute({ params }: Props) {
|
||||
const { account, pageId } = await params;
|
||||
const client = getSupabaseServerClient();
|
||||
const { data: acct } = await client.from('accounts').select('id').eq('slug', account).single();
|
||||
const { data: acct } = await client
|
||||
.from('accounts')
|
||||
.select('id')
|
||||
.eq('slug', account)
|
||||
.single();
|
||||
if (!acct) return <AccountNotFound />;
|
||||
|
||||
const api = createSiteBuilderApi(client);
|
||||
const page = await api.getPage(pageId);
|
||||
if (!page) return <div>Seite nicht gefunden</div>;
|
||||
|
||||
return <SiteEditor pageId={pageId} accountId={acct.id} initialData={(page.puck_data ?? {}) as Record<string, unknown>} />;
|
||||
return (
|
||||
<SiteEditor
|
||||
pageId={pageId}
|
||||
accountId={acct.id}
|
||||
initialData={(page.puck_data ?? {}) as Record<string, unknown>}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user