mirror of
https://github.com/logto-io/logto.git
synced 2024-12-16 20:26:19 -05:00
fix(console): should reset the form every time close CreateTenantModal (#4244)
This commit is contained in:
parent
199e747781
commit
605e2b2a81
1 changed files with 6 additions and 2 deletions
|
@ -49,8 +49,10 @@ function CreateTenantModal({ isOpen, onClose, skipPlanSelection = false }: Props
|
|||
const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' });
|
||||
const [tenantData, setTenantData] = useState<CreateTenantData>();
|
||||
const theme = useTheme();
|
||||
|
||||
const defaultValues = { tag: TenantTag.Development };
|
||||
const methods = useForm<CreateTenantData>({
|
||||
defaultValues: { tag: TenantTag.Development },
|
||||
defaultValues,
|
||||
});
|
||||
|
||||
const {
|
||||
|
@ -67,7 +69,6 @@ function CreateTenantModal({ isOpen, onClose, skipPlanSelection = false }: Props
|
|||
void trySafe(async () => {
|
||||
const { name, tag } = data;
|
||||
const newTenant = await cloudApi.post('/api/tenants', { body: { name, tag } });
|
||||
reset();
|
||||
onClose(newTenant);
|
||||
});
|
||||
};
|
||||
|
@ -85,6 +86,9 @@ function CreateTenantModal({ isOpen, onClose, skipPlanSelection = false }: Props
|
|||
isOpen={isOpen}
|
||||
className={modalStyles.content}
|
||||
overlayClassName={modalStyles.overlay}
|
||||
onAfterClose={() => {
|
||||
reset(defaultValues);
|
||||
}}
|
||||
onRequestClose={() => {
|
||||
onClose();
|
||||
}}
|
||||
|
|
Loading…
Reference in a new issue