fix: delete import (#859)

This commit is contained in:
Aaryan Khandelwal 2023-04-17 18:34:18 +05:30 committed by GitHub
parent 7aa9e0bba1
commit bd0cfef02f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 4 deletions

View File

@ -45,7 +45,7 @@ export const DeleteImportModal: React.FC<Props> = ({ isOpen, handleClose, data }
false false
); );
IntegrationService.deleteImporterService(workspaceSlug as string, data.id) IntegrationService.deleteImporterService(workspaceSlug as string, data.service, data.id)
.catch(() => .catch(() =>
setToastAlert({ setToastAlert({
type: "error", type: "error",
@ -53,7 +53,10 @@ export const DeleteImportModal: React.FC<Props> = ({ isOpen, handleClose, data }
message: "Something went wrong. Please try again.", message: "Something went wrong. Please try again.",
}) })
) )
.finally(() => setDeleteLoading(false)); .finally(() => {
setDeleteLoading(false);
handleClose();
});
}; };
if (!data) return <></>; if (!data) return <></>;

View File

@ -43,8 +43,12 @@ class IntegrationService extends APIService {
}); });
} }
async deleteImporterService(workspaceSlug: string, importerId: string): Promise<any> { async deleteImporterService(
return this.delete(`/api/workspaces/${workspaceSlug}/importers/${importerId}/`) workspaceSlug: string,
service: string,
importerId: string
): Promise<any> {
return this.delete(`/api/workspaces/${workspaceSlug}/importers/${service}/${importerId}/`)
.then((res) => res?.data) .then((res) => res?.data)
.catch((error) => { .catch((error) => {
throw error?.response?.data; throw error?.response?.data;