File size: 498 Bytes
a85305f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
"use server"

import { revalidatePath } from "next/cache"
import { createNewVideo } from "."

export async function isAdmin(adminSecret: string) {
  return adminSecret === process.env.ADMIN_SECRET
}

export async function handleFormSubmit(formData: FormData) {
  const ownerId = `${formData.get("ownerId") || ""}`
  await createNewVideo(ownerId, {
    prompt: `${formData.get("prompt") || ""}`,
  })
}

export async function refreshStudio(ownerId: string) {
  revalidatePath(`/studio/${ownerId}`)
}