feat: add update and delete functionality for courses, events, and species; enhance attendance tracking and category creation
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
import { notFound } from 'next/navigation';
|
||||
|
||||
import { createFischereiApi } from '@kit/fischerei/api';
|
||||
import {
|
||||
FischereiTabNavigation,
|
||||
CreateWaterForm,
|
||||
} from '@kit/fischerei/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; waterId: string }>;
|
||||
}
|
||||
|
||||
export default async function EditWaterPage({ params }: Props) {
|
||||
const { account, waterId } = await params;
|
||||
const client = getSupabaseServerClient();
|
||||
|
||||
const { data: acct } = await client
|
||||
.from('accounts')
|
||||
.select('id')
|
||||
.eq('slug', account)
|
||||
.single();
|
||||
|
||||
if (!acct) return <AccountNotFound />;
|
||||
|
||||
const api = createFischereiApi(client);
|
||||
|
||||
let water;
|
||||
|
||||
try {
|
||||
water = await api.getWater(waterId);
|
||||
} catch {
|
||||
notFound();
|
||||
}
|
||||
|
||||
return (
|
||||
<CmsPageShell account={account} title="Gewässer bearbeiten">
|
||||
<FischereiTabNavigation account={account} activeTab="waters" />
|
||||
<CreateWaterForm accountId={acct.id} account={account} water={water} />
|
||||
</CmsPageShell>
|
||||
);
|
||||
}
|
||||
@@ -44,6 +44,7 @@ export default async function WatersPage({ params, searchParams }: Props) {
|
||||
page={page}
|
||||
pageSize={25}
|
||||
account={account}
|
||||
accountId={acct.id}
|
||||
/>
|
||||
</CmsPageShell>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user