refactor progress
This commit is contained in:
@@ -17,21 +17,26 @@
|
||||
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import * as ModalActionCreators from '@app/actions/ModalActionCreators';
|
||||
import * as UserActionCreators from '@app/actions/UserActionCreators';
|
||||
import {Form} from '@app/components/form/Form';
|
||||
import {FormErrorText} from '@app/components/form/FormErrorText';
|
||||
import styles from '@app/components/modals/AccountDeleteModal.module.css';
|
||||
import * as Modal from '@app/components/modals/Modal';
|
||||
import {Button} from '@app/components/uikit/button/Button';
|
||||
import {useFormSubmit} from '@app/hooks/useFormSubmit';
|
||||
import * as RouterUtils from '@app/utils/RouterUtils';
|
||||
import {Trans, useLingui} from '@lingui/react/macro';
|
||||
import {observer} from 'mobx-react-lite';
|
||||
import {useForm} from 'react-hook-form';
|
||||
import * as ModalActionCreators from '~/actions/ModalActionCreators';
|
||||
import * as UserActionCreators from '~/actions/UserActionCreators';
|
||||
import {Form} from '~/components/form/Form';
|
||||
import styles from '~/components/modals/AccountDeleteModal.module.css';
|
||||
import * as Modal from '~/components/modals/Modal';
|
||||
import {Button} from '~/components/uikit/Button/Button';
|
||||
import {useFormSubmit} from '~/hooks/useFormSubmit';
|
||||
import * as RouterUtils from '~/utils/RouterUtils';
|
||||
|
||||
interface FormInputs {
|
||||
form: string;
|
||||
}
|
||||
|
||||
export const AccountDeleteModal = observer(() => {
|
||||
const {t} = useLingui();
|
||||
const form = useForm();
|
||||
const form = useForm<FormInputs>();
|
||||
|
||||
const onSubmit = async () => {
|
||||
await UserActionCreators.deleteAccount();
|
||||
@@ -49,8 +54,9 @@ export const AccountDeleteModal = observer(() => {
|
||||
<Modal.Root size="small" centered>
|
||||
<Form form={form} onSubmit={handleSubmit} aria-label={t`Delete account form`}>
|
||||
<Modal.Header title={t`Delete Account`} />
|
||||
<Modal.Content className={styles.content}>
|
||||
<Modal.Content contentClassName={styles.content}>
|
||||
<div className={styles.infoSection}>
|
||||
<FormErrorText message={form.formState.errors.form?.message} />
|
||||
<p>
|
||||
<Trans>
|
||||
Are you sure you want to delete your account? This action will schedule your account for permanent
|
||||
|
||||
Reference in New Issue
Block a user