Client: Confirm: ChangeOwner: add text after change

This commit is contained in:
Viktor Fomin 2023-04-21 13:59:52 +03:00
parent 46505c4c5f
commit 4cda75877c

View File

@ -20,6 +20,7 @@ import { getUserFromConfirm } from "@docspace/common/api/people";
const ChangeOwnerForm = (props) => {
const { t, greetingTitle, linkData, history } = props;
const [newOwner, setNewOwner] = useState("");
const [isOwnerChanged, setIsOwnerChanged] = useState(false);
const ownerId = linkData.uid;
@ -36,7 +37,8 @@ const ChangeOwnerForm = (props) => {
const onChangeOwnerClick = async () => {
try {
await ownerChange(ownerId, linkData.confirmHeader);
history.push("/");
setIsOwnerChanged(true);
setTimeout(() => (location.href = "/"), 10000);
} catch (error) {
toastr.error(e);
console.error(error);
@ -57,28 +59,34 @@ const ChangeOwnerForm = (props) => {
</Text>
<FormWrapper>
<Text className="subtitle">
{t("ConfirmOwnerPortalTitle", { newOwner: newOwner })}
</Text>
<ButtonsWrapper>
<Button
primary
scale
size="medium"
label={t("Common:SaveButton")}
tabIndex={2}
isDisabled={false}
onClick={onChangeOwnerClick}
/>
<Button
scale
size="medium"
label={t("Common:CancelButton")}
tabIndex={2}
isDisabled={false}
onClick={onCancelClick}
/>
</ButtonsWrapper>
{isOwnerChanged ? (
<Text>{t("ConfirmOwnerPortalSuccessMessage")}</Text>
) : (
<>
<Text className="subtitle">
{t("ConfirmOwnerPortalTitle", { newOwner: newOwner })}
</Text>
<ButtonsWrapper>
<Button
primary
scale
size="medium"
label={t("Common:SaveButton")}
tabIndex={2}
isDisabled={false}
onClick={onChangeOwnerClick}
/>
<Button
scale
size="medium"
label={t("Common:CancelButton")}
tabIndex={2}
isDisabled={false}
onClick={onCancelClick}
/>
</ButtonsWrapper>
</>
)}
</FormWrapper>
</StyledBody>
</StyledContent>