added mechanism of deleting thirdparty connection on room creation cancelling

This commit is contained in:
mushka 2022-10-13 17:39:24 +03:00
parent 05838f3bc5
commit d9639f8971

View File

@ -30,12 +30,14 @@ const StyledModalDialog = styled(ModalDialog)`
const CreateRoomDialog = ({
t,
visible,
onClose,
closeEvent,
onCreate,
fetchedTags,
isLoading,
folderFormValidation,
setIsLoading,
deleteThirdParty,
}) => {
const [isScrollLocked, setIsScrollLocked] = useState(false);
const [isOauthWindowOpen, setIsOauthWindowOpen] = useState(false);
@ -75,13 +77,25 @@ const CreateRoomDialog = ({
}));
};
const onCreateRoom = () => onCreate(roomParams);
const onCreateRoom = async () => {
await onCreate({ ...roomParams });
setRoomParams(startRoomParams);
};
const isChooseRoomType = roomParams.type === undefined;
const goBack = () => {
setRoomParams({ ...startRoomParams });
};
const onClose = async () => {
if (!!roomParams.storageLocation.thirdpartyAccount) {
setIsLoading(true);
await deleteThirdParty(
roomParams.storageLocation.thirdpartyAccount.providerId
).finally(() => setIsLoading(false));
}
closeEvent();
};
return (
<StyledModalDialog
displayType="aside"
@ -94,13 +108,13 @@ const CreateRoomDialog = ({
>
<ModalDialog.Header>
<DialogHeader
isChooseRoomType={isChooseRoomType}
isChooseRoomType={!roomParams.type}
onArrowClick={goBack}
/>
</ModalDialog.Header>
<ModalDialog.Body>
{isChooseRoomType ? (
{!roomParams.type ? (
<RoomTypeList t={t} setRoomType={setRoomType} />
) : (
<SetRoomParams
@ -115,7 +129,7 @@ const CreateRoomDialog = ({
)}
</ModalDialog.Body>
{!isChooseRoomType && (
{!!roomParams.type && (
<ModalDialog.Footer>
<Button
tabIndex={5}