Web: Management: Spaces: fixed loader reset, added loader when changing domain

This commit is contained in:
Dmitry Sychugov 2024-01-17 16:58:43 +05:00
parent 6b90bbf7d0
commit 00a8bad715
2 changed files with 20 additions and 8 deletions

View File

@ -69,11 +69,12 @@ const ConfigurationSection = ({ t }: TConfigurationSection): JSX.Element => {
setReferenceLink(result);
setSpaceCreatedDialogVisible(true);
});
await authStore.settingsStore
.getAllPortals()
.finally(() => setIsLoading(false));
await authStore.settingsStore.getAllPortals();
} catch (err) {
toastr.error(err);
} finally {
setIsLoading(false);
}
}
};

View File

@ -9,6 +9,7 @@ import { observer } from "mobx-react";
import { TextInput } from "@docspace/shared/components/text-input";
import { useStore } from "SRC_DIR/store";
import { parseDomain } from "SRC_DIR/utils";
import { toastr } from "@docspace/shared/components/toast";
const StyledModal = styled(ModalDialogContainer)`
.create-docspace-input-block {
@ -24,7 +25,7 @@ const ChangeDomainDialogComponent = () => {
const { spacesStore, authStore } = useStore();
const [domainNameError, setDomainNameError] =
React.useState<null | Array<object>>(null);
const [isLoading, setIsLoading] = React.useState<boolean>(false);
const {
setDomainName,
getPortalDomain,
@ -48,10 +49,19 @@ const ChangeDomainDialogComponent = () => {
if (!isValidDomain) return;
await setDomainName(domain);
await authStore.settingsStore.getAllPortals();
await getPortalDomain();
onClose();
try {
setIsLoading(true);
await setDomainName(domain);
await authStore.settingsStore.getAllPortals();
await getPortalDomain();
onClose();
} catch (err) {
toastr.error(err);
} finally {
setIsLoading(false);
}
};
return (
@ -98,6 +108,7 @@ const ChangeDomainDialogComponent = () => {
</ModalDialog.Body>
<ModalDialog.Footer>
<Button
isLoading={isLoading}
key="CreateButton"
label={t("Common:ChangeButton")}
onClick={onClickDomainChange}