payment-backoffice/services/roles.services.ts
2025-12-27 10:57:56 +01:00

16 lines
407 B
TypeScript

import { IEditUserForm } from "@/app/features/UserRoles/User.interfaces";
export async function editUser(id: string, data: IEditUserForm) {
const res = await fetch(`/api/dashboard/admin/users/${id}`, {
method: "PUT",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(data),
});
if (!res.ok) {
throw new Error("Failed to update user");
}
return res.json();
}