fix: move initialLeadState out of use-server file into lead-types.ts

This commit is contained in:
kovakmedya
2026-05-02 22:40:05 +03:00
parent ea3d6f6045
commit f43818a51a
3 changed files with 10 additions and 10 deletions
@@ -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";
+1 -9
View File
@@ -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<string, string>;
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.";
+8
View File
@@ -0,0 +1,8 @@
export type LeadActionState = {
ok: boolean;
error?: string;
fieldErrors?: Record<string, string>;
leadId?: string;
};
export const initialLeadState: LeadActionState = { ok: false };