The best way to control Claude Code, Codex and more from any computer or phone

main
js 15 lines 576 Bytes
Raw
1 "use server";
2
3 import { getCloudflareContext } from "@opennextjs/cloudflare";
4 import { revalidatePath } from "next/cache";
5
6 // Server action: writes the entry into the FIXTURE_KV binding via
7 // getCloudflareContext, then revalidates the page so the next render
8 // (force-dynamic anyway) reflects it.
9 export async function signGuestbook(formData) {
10 const name = formData.get("name");
11 if (typeof name !== "string" || name.length === 0) return;
12 const { env } = getCloudflareContext();
13 await env.FIXTURE_KV.put("guestbook:latest", name);
14 revalidatePath("/guestbook");
15 }