import { notFound } from "next/navigation"; import { prisma } from "@/lib/prisma"; import { BackLink } from "@/components/back-link"; import { updateDiscountCodeAction } from "../../actions"; import { getLocale } from "@/i18n/locale"; import { getDictionary } from "@/i18n/get-dictionary"; function toDateInputValue(date: Date | null): string { if (!date) return ""; return date.toISOString().slice(0, 10); } export default async function AdminGutscheinEditPage(props: PageProps<"/admin/gutscheine/[id]">) { const t = getDictionary(await getLocale()); const { id } = await props.params; const { error } = await props.searchParams; const code = await prisma.discountCode.findUnique({ where: { id } }); if (!code) notFound(); return (
{error}
) : null}