forked from admin/zeropost-tool
21 lines
618 B
JavaScript
21 lines
618 B
JavaScript
import { notFound, redirect } from 'next/navigation';
|
|
import { requireUser } from '@/lib/session';
|
|
import { engine } from '@/lib/engine';
|
|
import Header from '@/components/Header';
|
|
import ChannelEdit from '@/components/ChannelEdit';
|
|
|
|
export default async function ChannelEditPage({ params }) {
|
|
const user = await requireUser();
|
|
if (!user) redirect('/login');
|
|
const { id } = await params;
|
|
let channel;
|
|
try { channel = await engine.getChannel(user.id, id); } catch { notFound(); }
|
|
if (!channel) notFound();
|
|
return (
|
|
<>
|
|
<Header user={user} />
|
|
<ChannelEdit channel={channel} />
|
|
</>
|
|
);
|
|
}
|