diff --git a/src/ui/components/userDetail/loginMethods/LoginMethods.tsx b/src/ui/components/userDetail/loginMethods/LoginMethods.tsx index ae309666..b739403d 100644 --- a/src/ui/components/userDetail/loginMethods/LoginMethods.tsx +++ b/src/ui/components/userDetail/loginMethods/LoginMethods.tsx @@ -414,7 +414,7 @@ export const LoginMethods: React.FC = ({ refetchAllData, refet getUserDeleteConfirmationProps({ loginMethod: loginMethod, user: userDetail.details, - onDeleteCallback: (user) => onDeleteCallback(user.id), + onDeleteCallback: (userId) => onDeleteCallback(userId), all: false, }) ), diff --git a/src/ui/components/userDetail/userDetail.tsx b/src/ui/components/userDetail/userDetail.tsx index b0c05b1b..cc2b607c 100644 --- a/src/ui/components/userDetail/userDetail.tsx +++ b/src/ui/components/userDetail/userDetail.tsx @@ -23,7 +23,6 @@ import { getTenantsObjectsForIds } from "../../../utils/user"; import { PopupContentContext } from "../../contexts/PopupContentContext"; import { User, UserRecipeType } from "../../pages/usersList/types"; import { getMissingTenantIdModalProps } from "../common/modals/TenantIdModals"; -import { OnSelectUserFunction } from "../usersListTable/UsersListTable"; import { UserDetailContextProvider } from "./context/UserDetailContext"; import { LoginMethods } from "./loginMethods/LoginMethods"; import "./tenantList/UserTenantsList.scss"; @@ -38,7 +37,7 @@ import UserRolesList from "./userRoles/UserRolesList"; export type UserDetailProps = { user: string; onBackButtonClicked: () => void; - onDeleteCallback: OnSelectUserFunction; + onDeleteCallback: (userId: string) => void; onSendEmailVerificationCallback: (user: User) => Promise; onUpdateEmailVerificationStatusCallback: ( userId: string, diff --git a/src/ui/components/userDetail/userDetailForm.tsx b/src/ui/components/userDetail/userDetailForm.tsx index f92dcc0a..3b2213c3 100644 --- a/src/ui/components/userDetail/userDetailForm.tsx +++ b/src/ui/components/userDetail/userDetailForm.tsx @@ -27,7 +27,6 @@ import { getMissingTenantIdModalProps } from "../common/modals/TenantIdModals"; import InputField from "../inputField/InputField"; import { LayoutModalProps } from "../layout/layoutModal"; import { ToastNotificationProps } from "../toast/toastNotification"; -import { OnSelectUserFunction } from "../usersListTable/UsersListTable"; import "./userDetailForm.scss"; type PasswordChangeCallback = (password?: string) => Promise; @@ -61,7 +60,7 @@ type UserDeleteConfirmationProps = UserProps & { type UserUnlinkConfirmationProps = { onConfirmed: (isConfirmed: boolean) => void; loginMethod: LoginMethod }; type UserDeleteConfirmationTriggerProps = UserProps & { - onDeleteCallback: OnSelectUserFunction; + onDeleteCallback: (userId: string) => void; loginMethod?: LoginMethod; all: boolean; }; @@ -549,7 +548,11 @@ export const getUserDeleteConfirmationProps = (props: UserDeleteConfirmationTrig const onConfirmedDelete = (isConfirmed: boolean) => { if (isConfirmed) { - onDeleteCallback(user); + if (loginMethod) { + onDeleteCallback(loginMethod.recipeUserId); + } else { + onDeleteCallback(user.id); + } } closeConfirmDeleteRef.current?.(); }; diff --git a/src/ui/pages/usersList/UsersList.tsx b/src/ui/pages/usersList/UsersList.tsx index c01c7982..033cb1ef 100644 --- a/src/ui/pages/usersList/UsersList.tsx +++ b/src/ui/pages/usersList/UsersList.tsx @@ -480,7 +480,7 @@ export const UserListPage = () => { }} user={selectedUser} onBackButtonClicked={backToList} - onDeleteCallback={({ id }) => onUserDelete(id)} + onDeleteCallback={(userId) => onUserDelete(userId)} onSendEmailVerificationCallback={({ id, tenantIds }) => { return sendUserEmailVerification(id, tenantIds.length > 0 ? tenantIds[0] : undefined); }} @@ -500,7 +500,7 @@ export const UserListPage = () => { css={isSelectedUserNotEmpty ? { display: "none" } : undefined} reloadRef={reloadListRef} onChangePasswordCallback={changePassword} - onDeleteCallback={({ id }) => onUserDelete(id)} + onDeleteCallback={(userId) => onUserDelete(userId)} /> );