Create/detail updates
This commit is contained in:
parent
b0fb643b6a
commit
0997e449bb
26 changed files with 684 additions and 108 deletions
|
|
@ -0,0 +1,28 @@
|
|||
"use server";
|
||||
|
||||
import { revalidatePath } from "next/cache";
|
||||
import { db } from "@/app/_lib/database";
|
||||
|
||||
export const addFacebookBotAction = async (
|
||||
currentState: any,
|
||||
formData: FormData,
|
||||
) => {
|
||||
const newBot = {
|
||||
name: formData.get("name")?.toString() ?? null,
|
||||
description: formData.get("description")?.toString() ?? null,
|
||||
appId: formData.get("appId")?.toString() ?? null,
|
||||
appSecret: formData.get("appSecret")?.toString() ?? null,
|
||||
pageId: formData.get("pageId")?.toString() ?? null,
|
||||
pageAccessToken: formData.get("pageAccessToken")?.toString() ?? null,
|
||||
};
|
||||
|
||||
await db.insertInto("FacebookBot").values(newBot).execute();
|
||||
|
||||
revalidatePath("/facebook");
|
||||
|
||||
return {
|
||||
...currentState,
|
||||
values: newBot,
|
||||
success: true,
|
||||
};
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue