Skip to content

Commit ef76179

Browse files
authored
♻️ Update DeleteConfirmation component to use new service (#1224)
1 parent 0b16db4 commit ef76179

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

frontend/src/components/UserSettings/DeleteConfirmation.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { useMutation, useQueryClient } from "@tanstack/react-query"
1111
import React from "react"
1212
import { useForm } from "react-hook-form"
1313

14-
import { type ApiError, type UserPublic, UsersService } from "../../client"
14+
import { UsersService, type ApiError } from "../../client"
1515
import useAuth from "../../hooks/useAuth"
1616
import useCustomToast from "../../hooks/useCustomToast"
1717

@@ -28,11 +28,10 @@ const DeleteConfirmation = ({ isOpen, onClose }: DeleteProps) => {
2828
handleSubmit,
2929
formState: { isSubmitting },
3030
} = useForm()
31-
const currentUser = queryClient.getQueryData<UserPublic>(["currentUser"])
3231
const { logout } = useAuth()
3332

3433
const mutation = useMutation({
35-
mutationFn: (id: number) => UsersService.deleteUser({ userId: id }),
34+
mutationFn: () => UsersService.deleteUserMe(),
3635
onSuccess: () => {
3736
showToast(
3837
"Success",
@@ -52,7 +51,7 @@ const DeleteConfirmation = ({ isOpen, onClose }: DeleteProps) => {
5251
})
5352

5453
const onSubmit = async () => {
55-
mutation.mutate(currentUser!.id)
54+
mutation.mutate()
5655
}
5756

5857
return (

0 commit comments

Comments
 (0)