From ef76179f9fb32666d40801657f56ba2648b39e2c Mon Sep 17 00:00:00 2001 From: Alejandra <90076947+alejsdev@users.noreply.github.com> Date: Wed, 5 Jun 2024 12:25:47 -0500 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Update=20DeleteConfirmatio?= =?UTF-8?q?n=20component=20to=20use=20new=20service=20(#1224)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/UserSettings/DeleteConfirmation.tsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/frontend/src/components/UserSettings/DeleteConfirmation.tsx b/frontend/src/components/UserSettings/DeleteConfirmation.tsx index f551451..87f11de 100644 --- a/frontend/src/components/UserSettings/DeleteConfirmation.tsx +++ b/frontend/src/components/UserSettings/DeleteConfirmation.tsx @@ -11,7 +11,7 @@ import { useMutation, useQueryClient } from "@tanstack/react-query" import React from "react" import { useForm } from "react-hook-form" -import { type ApiError, type UserPublic, UsersService } from "../../client" +import { UsersService, type ApiError } from "../../client" import useAuth from "../../hooks/useAuth" import useCustomToast from "../../hooks/useCustomToast" @@ -28,11 +28,10 @@ const DeleteConfirmation = ({ isOpen, onClose }: DeleteProps) => { handleSubmit, formState: { isSubmitting }, } = useForm() - const currentUser = queryClient.getQueryData(["currentUser"]) const { logout } = useAuth() const mutation = useMutation({ - mutationFn: (id: number) => UsersService.deleteUser({ userId: id }), + mutationFn: () => UsersService.deleteUserMe(), onSuccess: () => { showToast( "Success", @@ -52,7 +51,7 @@ const DeleteConfirmation = ({ isOpen, onClose }: DeleteProps) => { }) const onSubmit = async () => { - mutation.mutate(currentUser!.id) + mutation.mutate() } return (