import Link from "next/link"; import { redirect } from "next/navigation"; import { ShellPage } from "@/components/page-templates"; import { Button, SectionCard } from "@/components/ui"; import { getSession } from "@/lib/auth"; import { updateContact } from "@/lib/admin-crud"; import { prisma } from "@/lib/prisma"; export default async function EditContactPage({ params }: { params: Promise<{ contactId: string }> }) { const { contactId } = await params; const session = await getSession(); if (!session) { redirect("/login"); } const contact = await prisma.contact.findFirst({ where: { id: contactId, tenantId: session.tenantId }, include: { contactTags: { include: { tag: true } }, channel: true } }); if (!contact) { redirect("/contacts?error=contact_not_found"); } const channels = await prisma.channel.findMany({ where: { tenantId: session.tenantId }, orderBy: { channelName: "asc" } }); const tags = contact.contactTags.map((item) => item.tag.name).join(", "); return (
Cancel
); }