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

@@ -1,7 +1,6 @@
import { createClient } from "@/lib/supabase-server" import { createClient } from "@/lib/supabase-server"
import { getSiteContents } from "@/lib/data" import { getSiteContents } from "@/lib/data"
import { notFound } from "next/navigation" import { notFound } from "next/navigation"
import Image from "next/image"
import Link from "next/link" import Link from "next/link"
import { Button } from "@/components/ui/button" import { Button } from "@/components/ui/button"
import { Badge } from "@/components/ui/badge" import { Badge } from "@/components/ui/badge"

View File

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

View File

@@ -30,7 +30,7 @@ import {
SelectTrigger, SelectTrigger,
SelectValue, SelectValue,
} from "@/components/ui/select" } 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 { toast } from "sonner"
import { ScrollArea } from "@/components/ui/scroll-area" import { ScrollArea } from "@/components/ui/scroll-area"