File size: 498 Bytes
43dd1ac
 
 
8f24b44
92864d8
4fe04e4
 
 
 
8f24b44
92864d8
8f24b44
43dd1ac
 
92864d8
 
 
 
43dd1ac
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}`)
}