16 lines
436 B
TypeScript
16 lines
436 B
TypeScript
import { IEditUserForm } from "@/app/features/UserRoles/User.interfaces";
|
|
|
|
export async function createRole(data: IEditUserForm) {
|
|
const res = await fetch("/api/dashboard/admin/users", {
|
|
method: "POST",
|
|
headers: { "Content-Type": "application/json" },
|
|
body: JSON.stringify(data),
|
|
});
|
|
|
|
if (!res.ok) {
|
|
throw new Error("Failed to create role");
|
|
}
|
|
|
|
return res.json(); // or return type depending on your backend
|
|
}
|