frontend: kanal ekleme formu
Dashboard'a name/youtubeHandle/channelId alanlarıyla bir server action formu eklendi. Polling ve /status için channel_id gerçek bir YouTube UC... kimliği olmalı. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
"use server";
|
||||
|
||||
import { prisma } from "@streamclipper/db";
|
||||
import { revalidatePath } from "next/cache";
|
||||
|
||||
export async function addChannel(formData: FormData) {
|
||||
const name = String(formData.get("name") ?? "").trim();
|
||||
const youtubeHandle = String(formData.get("youtubeHandle") ?? "").trim();
|
||||
const channelId = String(formData.get("channelId") ?? "").trim();
|
||||
|
||||
if (!name || !youtubeHandle || !channelId) {
|
||||
throw new Error("Kanal adı, handle ve channel_id alanları zorunlu.");
|
||||
}
|
||||
|
||||
await prisma.channel.create({
|
||||
data: { name, youtubeHandle, channelId, isActive: true },
|
||||
});
|
||||
|
||||
revalidatePath("/");
|
||||
}
|
||||
Reference in New Issue
Block a user