feat: add delete functionality for leases, catch books, and permits; implement newsletter update feature
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
import { createNewsletterApi } from '@kit/newsletter/api';
|
||||
import { CreateNewsletterForm } from '@kit/newsletter/components';
|
||||
import { getSupabaseServerClient } from '@kit/supabase/server-client';
|
||||
|
||||
import { AccountNotFound } from '~/components/account-not-found';
|
||||
import { CmsPageShell } from '~/components/cms-page-shell';
|
||||
|
||||
interface Props {
|
||||
params: Promise<{ account: string; campaignId: string }>;
|
||||
}
|
||||
|
||||
export default async function EditNewsletterPage({ params }: Props) {
|
||||
const { account, campaignId } = await params;
|
||||
const client = getSupabaseServerClient();
|
||||
|
||||
const { data: acct } = await client
|
||||
.from('accounts')
|
||||
.select('id')
|
||||
.eq('slug', account)
|
||||
.single();
|
||||
|
||||
if (!acct) return <AccountNotFound />;
|
||||
|
||||
const api = createNewsletterApi(client);
|
||||
const newsletter = await api.getNewsletter(campaignId);
|
||||
if (!newsletter) return <AccountNotFound />;
|
||||
|
||||
const n = newsletter as Record<string, unknown>;
|
||||
|
||||
return (
|
||||
<CmsPageShell account={account} title="Newsletter bearbeiten">
|
||||
<CreateNewsletterForm
|
||||
accountId={acct.id}
|
||||
account={account}
|
||||
newsletterId={campaignId}
|
||||
initialData={{
|
||||
subject: String(n.subject ?? ''),
|
||||
bodyHtml: String(n.body_html ?? ''),
|
||||
bodyText: String(n.body_text ?? ''),
|
||||
scheduledAt: String(n.scheduled_at ?? ''),
|
||||
}}
|
||||
/>
|
||||
</CmsPageShell>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user