This commit is contained in:
2026-06-09 15:15:40 +03:00
parent f6b4acb760
commit d908d83ca5
58 changed files with 4320 additions and 419 deletions
+48
View File
@@ -0,0 +1,48 @@
"use server";
import { revalidatePath } from "next/cache";
import prisma from "@/lib/prisma";
export type HeroActionState = {
success?: boolean;
message?: string;
} | null;
export async function updateHero(prevState: HeroActionState, formData: FormData): Promise<HeroActionState> {
const lang = formData.get("lang") as string;
const location = formData.get("location") as string;
const welcome = formData.get("welcome") as string;
const title = formData.get("title") as string;
const subtitle = formData.get("subtitle") as string;
const bookNow = formData.get("bookNow") as string;
const exploreActivities = formData.get("exploreActivities") as string;
const scroll = formData.get("scroll") as string;
if (!lang) {
return { success: false, message: "Dil seçimi eksik." };
}
await prisma.heroSection.upsert({
where: { lang },
update: { location, welcome, title, subtitle, bookNow, exploreActivities, scroll },
create: {
lang,
location,
welcome,
title,
subtitle,
bookNow,
exploreActivities,
scroll
}
});
revalidatePath('/admin/hero');
revalidatePath(`/${lang}`);
revalidatePath('/');
return {
success: true,
message: `${lang.toUpperCase()} Hero ayarları başarıyla kaydedildi!`
};
}