Migrate Admin user components to new client API

This commit is contained in:
Yurii Motov
2026-07-23 21:55:28 +02:00
parent 865a31954f
commit 3bdfa168b6
4 changed files with 4 additions and 6 deletions
+1 -2
View File
@@ -72,8 +72,7 @@ const AddUser = () => {
}) })
const mutation = useMutation({ const mutation = useMutation({
mutationFn: (data: UserCreate) => mutationFn: (data: UserCreate) => UsersService.createUser({ body: data }),
UsersService.createUser({ requestBody: data }),
onSuccess: () => { onSuccess: () => {
showSuccessToast("User created successfully") showSuccessToast("User created successfully")
form.reset() form.reset()
+1 -1
View File
@@ -31,7 +31,7 @@ const DeleteUser = ({ id, onSuccess }: DeleteUserProps) => {
const { handleSubmit } = useForm() const { handleSubmit } = useForm()
const deleteUser = async (id: string) => { const deleteUser = async (id: string) => {
await UsersService.deleteUser({ userId: id }) await UsersService.deleteUser({ path: { user_id: id } })
} }
const mutation = useMutation({ const mutation = useMutation({
+1 -1
View File
@@ -75,7 +75,7 @@ const EditUser = ({ user, onSuccess }: EditUserProps) => {
const mutation = useMutation({ const mutation = useMutation({
mutationFn: (data: FormData) => mutationFn: (data: FormData) =>
UsersService.updateUser({ userId: user.id, requestBody: data }), UsersService.updateUser({ path: { user_id: user.id }, body: data }),
onSuccess: () => { onSuccess: () => {
showSuccessToast("User updated successfully") showSuccessToast("User updated successfully")
setIsOpen(false) setIsOpen(false)
+1 -2
View File
@@ -53,8 +53,7 @@ const AddItem = () => {
}) })
const mutation = useMutation({ const mutation = useMutation({
mutationFn: (data: ItemCreate) => mutationFn: (data: ItemCreate) => ItemsService.createItem({ body: data }),
ItemsService.createItem({ requestBody: data }),
onSuccess: () => { onSuccess: () => {
showSuccessToast("Item created successfully") showSuccessToast("Item created successfully")
form.reset() form.reset()