diff --git a/app/(dashboard)/customer/reminder/edit/[id]/page.tsx b/app/(dashboard)/customer/reminder/edit/[id]/page.tsx
index 5fde11f..aa185a3 100644
--- a/app/(dashboard)/customer/reminder/edit/[id]/page.tsx
+++ b/app/(dashboard)/customer/reminder/edit/[id]/page.tsx
@@ -1,7 +1,6 @@
import ButtonsExport from "@/components/shared/detay/buttons-export"
import { buttonVariants } from "@/components/ui/button"
import Link from "next/link"
-import CustomerEditForm from "@/components/shared/customer-edit-form"
import ReminderEditForm from "@/components/shared/reminder/reminder-edit-form"
export default async function CustomerDetails({
params,
@@ -16,7 +15,7 @@ export default async function CustomerDetails({
return
Back
-
+
diff --git a/components/shared/detay/buttons-export.tsx b/components/shared/detay/buttons-export.tsx
index a422aea..00142a1 100644
--- a/components/shared/detay/buttons-export.tsx
+++ b/components/shared/detay/buttons-export.tsx
@@ -11,7 +11,7 @@ import { TiTick } from "react-icons/ti";
type ButtonsExportProps = {
- data: Customer
+ data?: Customer
type?: "reminder" | "customer"
};
const ButtonsExport: React.FC = ({ data, type }) => {
@@ -21,7 +21,7 @@ const ButtonsExport: React.FC = ({ data, type }) => {
ExportToExcel(data);
};
const handleDelete = async () => {
- const url = type !== 'reminder' ? ` ${"https://crm-backend-production-e80f.up.railway.app/api"}/customers/${data._id} ` : ` ${"https://crm-backend-production-e80f.up.railway.app/api"}/reminder/${data._id}`
+ const url = type !== 'reminder' ? ` ${"https://crm-backend-production-e80f.up.railway.app/api"}/customers/${data?._id} ` : ` ${"https://crm-backend-production-e80f.up.railway.app/api"}/reminder/${data?._id}`
try {
const response = await fetch(`${url}`, {
method: 'DELETE',
diff --git a/utils/ExportToCSV.ts b/utils/ExportToCSV.ts
index 08198de..24f3efc 100644
--- a/utils/ExportToCSV.ts
+++ b/utils/ExportToCSV.ts
@@ -3,18 +3,18 @@
import * as XLSX from "xlsx";
import { Customer } from "@/types/customer/model";
-export const ExportToExcel = (data: Customer) => {
+export const ExportToExcel = (data?: Customer) => {
const headers = ["Adı", "Soyadı", "Cinsiyet", "Müşteri Segmenti", "Telefon", "E-posta"];
// Müşteri verilerini tablo satırı olarak düzenliyoruz
const rows = [
[
- data.ad,
- data.soyad,
- data.cinsiyet,
- data.segmentasyon?.musteri_segmenti || "",
- data.iletisim_bilgileri?.telefon || "",
- data.iletisim_bilgileri?.email || ""
+ data?.ad,
+ data?.soyad,
+ data?.cinsiyet,
+ data?.segmentasyon?.musteri_segmenti || "",
+ data?.iletisim_bilgileri?.telefon || "",
+ data?.iletisim_bilgileri?.email || ""
]
];