41 lines
1.1 KiB
TypeScript
41 lines
1.1 KiB
TypeScript
import Link from 'next/link';
|
|
import { sites } from '../../../../_config/sites';
|
|
import {
|
|
articleFindById,
|
|
articleGroupsFindAll,
|
|
} from '../../../../actions/article.actions';
|
|
import { ArticleMainForm } from '../../../../components/article/articleMain.form';
|
|
import { categoryFindAll } from '../../../../actions/category.actions';
|
|
import { manufacturerFindAll } from '../../../../actions/manufacturer.actions';
|
|
|
|
export default async function ArticleUpdatePage({
|
|
params,
|
|
}: {
|
|
params: Promise<{ id: string }>;
|
|
}) {
|
|
const { id } = await params;
|
|
const [article, categories, manufacturer, groups] = await Promise.all([
|
|
articleFindById(id),
|
|
categoryFindAll(),
|
|
manufacturerFindAll(),
|
|
articleGroupsFindAll(),
|
|
]);
|
|
return (
|
|
<div>
|
|
{article ? (
|
|
<ArticleMainForm
|
|
initData={article}
|
|
categories={categories}
|
|
manufacturer={manufacturer}
|
|
groups={groups}
|
|
/>
|
|
) : (
|
|
<p>Artikel nicht gefunden.</p>
|
|
)}
|
|
<Link className="text-sky-700 p-6" href={sites.article.url}>
|
|
Zurück zu den Artikeln
|
|
</Link>
|
|
</div>
|
|
);
|
|
}
|