import React, { Fragment } from 'react'; import PropTypes from 'prop-types'; import { withTranslation } from 'react-i18next'; import { withUnstatedContainers } from '../../UnstatedUtils'; import AppContainer from '~/client/services/AppContainer'; import { toastSuccess, toastError } from '~/client/util/apiNotification'; import AdminUsersContainer from '~/client/services/AdminUsersContainer'; class RemoveAdminButton extends React.Component { constructor(props) { super(props); this.onClickRemoveAdminBtn = this.onClickRemoveAdminBtn.bind(this); } async onClickRemoveAdminBtn() { const { t } = this.props; try { const username = await this.props.adminUsersContainer.removeUserAdmin(this.props.user._id); toastSuccess(t('toaster.remove_user_admin', { username })); } catch (err) { toastError(err); } } renderRemoveAdminBtn() { const { t } = this.props; return ( ); } renderRemoveAdminAlert() { const { t } = this.props; return (
{t('admin:user_management.user_table.cannot_remove')}