Merge branch 'develop' into feature/my-documents-share

This commit is contained in:
Viktor Fomin 2024-01-18 00:19:38 +03:00
commit 3f6a9dcb58
3 changed files with 25 additions and 6 deletions

View File

@ -63,14 +63,18 @@ const ConfigurationSection = ({ t }: TConfigurationSection): JSX.Element => {
if (isValidDomain && isValidPortalName) {
try {
setIsLoading(true);
await setDomainName(domain);
await setPortalName(name).then((result) => {
setReferenceLink(result);
setSpaceCreatedDialogVisible(true);
});
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;
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}

View File

@ -41,6 +41,7 @@ const CreatePortalDialog = () => {
const [visit, setVisit] = React.useState<boolean>(false);
const [restrictAccess, setRestrictAccess] = React.useState<boolean>(false);
const [registerError, setRegisterError] = React.useState<null | string>(null);
const [isLoading, setIsLoading] = React.useState<boolean>(false);
const { spacesStore, authStore } = useStore();
const { tenantAlias, baseDomain, domainValidator } = authStore.settingsStore;
@ -82,6 +83,7 @@ const CreatePortalDialog = () => {
);
if (isValidPortalName) {
setIsLoading(true);
await createNewPortal(data)
.then(async (data) => {
const { tenant } = data;
@ -96,7 +98,8 @@ const CreatePortalDialog = () => {
})
.catch((error) => {
setRegisterError(error?.response?.data?.message);
});
})
.finally(() => setIsLoading(false));
}
};
@ -159,6 +162,7 @@ const CreatePortalDialog = () => {
</ModalDialog.Body>
<ModalDialog.Footer>
<Button
isLoading={isLoading}
key="CreateButton"
label={t("Common:Create")}
size="normal"