hata düzeltme

This commit is contained in:
2026-01-30 00:18:43 +03:00
parent d320787df6
commit d14b293bd8
3 changed files with 4 additions and 11 deletions

View File

@@ -31,7 +31,7 @@ import imageCompression from 'browser-image-compression'
import { createClient } from "@/lib/supabase-browser"
import Image from "next/image"
import { createProduct, updateProduct, deleteProductImage } from "@/app/(dashboard)/dashboard/products/actions"
import { createProduct, updateProduct } from "@/app/(dashboard)/dashboard/products/actions"
const productSchema = z.object({
name: z.string().min(2, "Ürün adı en az 2 karakter olmalıdır"),
@@ -167,14 +167,8 @@ export function ProductForm({ initialData }: ProductFormProps) {
const imageToDelete = previewImages[index]
// If editing an existing product and image is from server (starts with http/https usually)
if (initialData && imageToDelete.startsWith("http")) {
const result = await deleteProductImage(imageToDelete, initialData.id)
if (!result.success) {
toast.error("Resim silinirken hata oluştu")
return
}
toast.success("Resim silindi")
}
// Local state removal only. Server update happens on Save.
// if (initialData && imageToDelete.startsWith("http")) { ... }
const currentImages = [...form.getValues("images") || []]
// Filter out the deleted image URL if it matches

View File

@@ -30,7 +30,7 @@ import {
SelectTrigger,
SelectValue,
} from "@/components/ui/select"
import { Loader2, Send, Users, Save, Trash2, BookOpen, Smartphone } from "lucide-react"
import { Loader2, Send, Save, Trash2, BookOpen, Smartphone } from "lucide-react"
import { toast } from "sonner"
import { ScrollArea } from "@/components/ui/scroll-area"