38 lines
1.4 KiB
TypeScript
38 lines
1.4 KiB
TypeScript
import Link from "next/link";
|
|
import { sites } from "../../../../_config/sites";
|
|
import { articleFindById } from "../../../../actions/article.actions";
|
|
import { ArticleMainForm } from "../../../../components/article/articleMain.form";
|
|
import { categoryFindAll } from "../../../../actions/category.actions";
|
|
import { manufacturerFindAll } from "../../../../actions/manufacturer.actions";
|
|
|
|
interface PageProps {
|
|
params: Promise<{ id: string }>
|
|
|
|
}
|
|
export default async function CatergoryUpdate({ params }: PageProps) {
|
|
|
|
|
|
const { id } = await params
|
|
const article = await articleFindById(id);
|
|
const cats = await categoryFindAll();
|
|
const manufacturer = await manufacturerFindAll();
|
|
|
|
if(!article._id) {
|
|
return (<div>
|
|
<div>Artikel nicht gefunden</div>
|
|
<div>
|
|
<Link className="cursor-pointer p-2 border-1 border-sky-500 bg-sky-500 text-white rounded-full m-1 hover:bg-sky-700 " href={sites.article.url}>zurück1</Link>
|
|
</div>
|
|
</div>)
|
|
}
|
|
const {name,category,variants} = article;
|
|
console.log('Varianten:',article.variants)
|
|
|
|
return (
|
|
<div className="h-screen">
|
|
<ArticleMainForm initData={article} categories={cats} manufacturer={manufacturer}></ArticleMainForm>
|
|
<Link className="cursor-pointer p-2 border-1 border-sky-500 bg-sky-500 text-white rounded-full m-1 hover:bg-sky-700 " href={sites.article.url}>zurück</Link>
|
|
</div>
|
|
);
|
|
}
|