mirror of
https://github.com/fastapi/full-stack-fastapi-template.git
synced 2026-11-03 20:36:27 +00:00
Migrate Admin user components to new client API
This commit is contained in:
@@ -72,8 +72,7 @@ const AddUser = () => {
|
||||
})
|
||||
|
||||
const mutation = useMutation({
|
||||
mutationFn: (data: UserCreate) =>
|
||||
UsersService.createUser({ requestBody: data }),
|
||||
mutationFn: (data: UserCreate) => UsersService.createUser({ body: data }),
|
||||
onSuccess: () => {
|
||||
showSuccessToast("User created successfully")
|
||||
form.reset()
|
||||
|
||||
@@ -31,7 +31,7 @@ const DeleteUser = ({ id, onSuccess }: DeleteUserProps) => {
|
||||
const { handleSubmit } = useForm()
|
||||
|
||||
const deleteUser = async (id: string) => {
|
||||
await UsersService.deleteUser({ userId: id })
|
||||
await UsersService.deleteUser({ path: { user_id: id } })
|
||||
}
|
||||
|
||||
const mutation = useMutation({
|
||||
|
||||
@@ -75,7 +75,7 @@ const EditUser = ({ user, onSuccess }: EditUserProps) => {
|
||||
|
||||
const mutation = useMutation({
|
||||
mutationFn: (data: FormData) =>
|
||||
UsersService.updateUser({ userId: user.id, requestBody: data }),
|
||||
UsersService.updateUser({ path: { user_id: user.id }, body: data }),
|
||||
onSuccess: () => {
|
||||
showSuccessToast("User updated successfully")
|
||||
setIsOpen(false)
|
||||
|
||||
@@ -53,8 +53,7 @@ const AddItem = () => {
|
||||
})
|
||||
|
||||
const mutation = useMutation({
|
||||
mutationFn: (data: ItemCreate) =>
|
||||
ItemsService.createItem({ requestBody: data }),
|
||||
mutationFn: (data: ItemCreate) => ItemsService.createItem({ body: data }),
|
||||
onSuccess: () => {
|
||||
showSuccessToast("Item created successfully")
|
||||
form.reset()
|
||||
|
||||
Reference in New Issue
Block a user