diff --git a/src/app/(dashboard)/leads/components/lead-form-sheet.tsx b/src/app/(dashboard)/leads/components/lead-form-sheet.tsx index c0b1103..091202e 100644 --- a/src/app/(dashboard)/leads/components/lead-form-sheet.tsx +++ b/src/app/(dashboard)/leads/components/lead-form-sheet.tsx @@ -19,9 +19,9 @@ import { import { Textarea } from "@/components/ui/textarea"; import { createLeadAction, - initialLeadState, updateLeadAction, } from "@/lib/appwrite/lead-actions"; +import { initialLeadState } from "@/lib/appwrite/lead-types"; import { LEAD_SOURCE_LABEL, LEAD_STATUS_CONFIG, type LeadRow, type MemberOption } from "./types"; diff --git a/src/lib/appwrite/lead-actions.ts b/src/lib/appwrite/lead-actions.ts index 192d19e..5b708f6 100644 --- a/src/lib/appwrite/lead-actions.ts +++ b/src/lib/appwrite/lead-actions.ts @@ -5,20 +5,12 @@ import { AppwriteException, ID, Permission, Role } from "node-appwrite"; import { z } from "zod"; import { logAudit } from "./audit"; +import type { LeadActionState } from "./lead-types"; import { DATABASE_ID, TABLES, type Lead, type LeadStatus } from "./schema"; import { createAdminClient } from "./server"; import { requireTenant } from "./tenant-guard"; import { leadSchema } from "@/lib/validation/leads"; -export type LeadActionState = { - ok: boolean; - error?: string; - fieldErrors?: Record; - leadId?: string; -}; - -export const initialLeadState: LeadActionState = { ok: false }; - function appwriteError(e: unknown): string { if (e instanceof AppwriteException) return e.message || "Beklenmeyen bir hata oluştu."; return "Bağlantı hatası. Tekrar deneyin."; diff --git a/src/lib/appwrite/lead-types.ts b/src/lib/appwrite/lead-types.ts new file mode 100644 index 0000000..86a4954 --- /dev/null +++ b/src/lib/appwrite/lead-types.ts @@ -0,0 +1,8 @@ +export type LeadActionState = { + ok: boolean; + error?: string; + fieldErrors?: Record; + leadId?: string; +}; + +export const initialLeadState: LeadActionState = { ok: false };