Add CRUD for other entities
This commit is contained in:
parent
f87bcc43a5
commit
a3e8b89128
64 changed files with 949 additions and 62 deletions
|
|
@ -0,0 +1,33 @@
|
|||
"use server";
|
||||
|
||||
import { addAction, updateAction, deleteAction } from "@/app/_lib/actions";
|
||||
|
||||
const entity = "users";
|
||||
const table = "User";
|
||||
|
||||
export const addUserAction = async (currentState: any, formData: FormData) => {
|
||||
return addAction({
|
||||
entity,
|
||||
table,
|
||||
fields: ["name"],
|
||||
currentState,
|
||||
formData,
|
||||
});
|
||||
};
|
||||
|
||||
export const updateUserAction = async (
|
||||
currentState: any,
|
||||
formData: FormData,
|
||||
) => {
|
||||
return updateAction({
|
||||
entity,
|
||||
table,
|
||||
fields: ["name"],
|
||||
currentState,
|
||||
formData,
|
||||
});
|
||||
};
|
||||
|
||||
export const deleteUserAction = async (id: string) => {
|
||||
return deleteAction({ entity, table, id });
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue