File size: 614 Bytes
43dd1ac
 
 
 
 
 
92864d8
 
c90a662
43dd1ac
 
92864d8
43dd1ac
c90a662
43dd1ac
92864d8
 
 
 
 
43dd1ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
"use server"

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

export async function formSubmit(formData: FormData) {

  const ownerId = `${formData.get("ownerId") || ""}`
  console.log('submitting to ', ownerId)
  await submitNewTask({
    prompt: `${formData.get("prompt") || ""}`,
    ownerId,
  })
  console.log('calling revalidate', ownerId)
  // for doc see https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions
  revalidatePath(`/studio/${ownerId}`)
}

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