优化后端,实现前端添加用户

This commit is contained in:
2025-05-12 13:29:29 +08:00
parent 805901767c
commit 74f874109c
6 changed files with 141 additions and 8 deletions

View File

@@ -1,3 +1,20 @@
export function create() {
import { User } from "@/lib/types/user";
import fetcher from "../../fetcher";
interface createUserParams {
username: string | null;
nickname: string | null;
email: string | null;
phone: string | null;
password: string | null;
}
export async function create(data: createUserParams) {
return fetcher<User>("/api/admin/user", {
method: "POST",
body: JSON.stringify(data),
headers: {
"Content-Type": "application/json",
},
});
}