@@ -21,7 +21,7 @@ import { getPersons } from '#/widgets/business-persons/api/get-persons' import ArrowUpOrDown from '#/widgets/top-bar-model/ui/arrow-up-or-down' import { translateEmailStatus, formatDateStatus, formatEmail } from '../../lib/lib' -import { getModalById, PLATE_CHANGE_PASSWORD, RESEND_INVATION_PASSWORD } from '#/features/modals' +import { getModalById, PLATE_CHANGE_PASSWORD } from '#/features/modals' import { ResponseGetBusinessGroups } from '#/features/invite-person-in-business/model/types' import { useShowDataStore } from '#/shared/lib/hooks/use-show-data' import { resendInvation } from '#/features/resend-invation-corp/api/resend-invation' @@ -43,7 +43,6 @@ export const PersonsList = ({ const { data: session } = useSession() const passChangeModal = getModalById(PLATE_CHANGE_PASSWORD) - const passResendModal = getModalById(RESEND_INVATION_PASSWORD) useEffect(() => { setPersons(personsList) @@ -39,23 +39,13 @@ import { API_URL } from '#/shared/lib/constants' // import styles from '#/widgets/business-models/ui/models-list/models-list.module.scss' import { getBusinessGroups } from '#/widgets/business-persons/api/get-businessGroups' import ArrowUpOrDown from '#/widgets/top-bar-model/ui/arrow-up-or-down' -import { getModalById, PLATE_CHANGE_PASSWORD, RESEND_INVATION_PASSWORD } from '#/features/modals' +import { getModalById, PLATE_CHANGE_PASSWORD } from '#/features/modals' import { formatDateStatus, formatEmail, translateEmailStatus } from '../../lib/lib' import { XMark } from '#/features/remove-person' import { useShowDataStore } from '#/shared/lib/hooks/use-show-data' import { resendInvation } from '#/features/resend-invation-corp/api/resend-invation' -interface ModalWithState { - setState: (isOpen: boolean, props?: any) => void -} - -interface ModalWithOpen { - open: (props?: any) => void -} - -type ModalType = ModalWithState | ModalWithOpen | ((props?: any) => void) | null - export const SecurityList = ({ securityList, setSecurityList, @@ -70,8 +60,7 @@ export const SecurityList = ({ const [inviteModal, setInviteModal] = useState(false) const [currentPerson, setCurrentPerson] = useState(null) - const passChangeModal = getModalById(PLATE_CHANGE_PASSWORD) as ModalType - const passResendModal = getModalById(RESEND_INVATION_PASSWORD) as ModalType + const passChangeModal = getModalById(PLATE_CHANGE_PASSWORD) useEffect(() => { setPersons(securityList) @@ -136,28 +125,7 @@ export const SecurityList = ({ } const handleChangePassword = (email: string) => { - if (passChangeModal && 'setState' in passChangeModal) { passChangeModal.setState(true, { email }) - } else if (passChangeModal && 'open' in passChangeModal) { - passChangeModal.open({ email }) - } else if (typeof passChangeModal === 'function') { - passChangeModal({ email, isOpen: true }) - } else { - console.error('Модальное окно смены пароля не настроено корректно', passChangeModal) - showMessage('Ошибка открытия модального окна', 'error') - } - } - - const handleResendInvitation = (email: string) => { - if (passResendModal && 'setState' in passResendModal) { - passResendModal.setState(true, { email }) - } else if (passResendModal && 'open' in passResendModal) { - passResendModal.open({ email }) - } else if (typeof passResendModal === 'function') { - passResendModal({ email, isOpen: true }) - } else { - handleOpenResendModal(email) - } } useEffect(() => { @@ -240,7 +208,7 @@ export const SecurityList = ({ {statusPerson === 'Приглашен' ? (