Skip to content
This repository was archived by the owner on May 13, 2024. It is now read-only.

Hubert / clearing register app form after submitting #218

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/features/dashboard/components/AppForm/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { ReactNode, useMemo } from 'react';
import React, { ReactNode, useCallback, useMemo } from 'react';
import { Text } from '@deriv/ui';
import { useForm } from 'react-hook-form';
import { isNotDemoCurrency } from '@site/src/utils';
Expand Down Expand Up @@ -33,6 +33,7 @@ const AppForm = ({
register,
handleSubmit,
formState: { errors },
reset,
} = useForm<IRegisterAppForm>({
mode: 'onBlur',
resolver: yupResolver(is_update_mode ? appEditSchema : appRegisterSchema),
Expand All @@ -53,6 +54,11 @@ const AppForm = ({
return admin_check_array.includes(true);
};

const submitAndReset = (e) => {
submit(e);
reset();
};

const disableMarkup = useMemo(() => {
let isDisabled;
isNotDemoCurrency(currentLoginAccount) === 'Demo' ? (isDisabled = true) : (isDisabled = false);
Expand All @@ -71,7 +77,7 @@ const AppForm = ({

return (
<React.Fragment>
<form role={'form'} className={styles.apps_form} onSubmit={handleSubmit(submit)}>
<form role={'form'} className={styles.apps_form} onSubmit={handleSubmit(submitAndReset)}>
<div
className={`${styles.formContent} ${
!admin_token && !is_update_mode ? styles.noAdmin : ''
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy