From bd0cfef02f5db7ca4db816125e997926fdacf1de Mon Sep 17 00:00:00 2001 From: Aaryan Khandelwal <65252264+aaryan610@users.noreply.github.com> Date: Mon, 17 Apr 2023 18:34:18 +0530 Subject: [PATCH] fix: delete import (#859) --- apps/app/components/integration/delete-import-modal.tsx | 7 +++++-- apps/app/services/integration/index.ts | 8 ++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/apps/app/components/integration/delete-import-modal.tsx b/apps/app/components/integration/delete-import-modal.tsx index 8c0e10874..b1ae01cc8 100644 --- a/apps/app/components/integration/delete-import-modal.tsx +++ b/apps/app/components/integration/delete-import-modal.tsx @@ -45,7 +45,7 @@ export const DeleteImportModal: React.FC = ({ isOpen, handleClose, data } false ); - IntegrationService.deleteImporterService(workspaceSlug as string, data.id) + IntegrationService.deleteImporterService(workspaceSlug as string, data.service, data.id) .catch(() => setToastAlert({ type: "error", @@ -53,7 +53,10 @@ export const DeleteImportModal: React.FC = ({ isOpen, handleClose, data } message: "Something went wrong. Please try again.", }) ) - .finally(() => setDeleteLoading(false)); + .finally(() => { + setDeleteLoading(false); + handleClose(); + }); }; if (!data) return <>; diff --git a/apps/app/services/integration/index.ts b/apps/app/services/integration/index.ts index 7adba88e8..45ee0adb8 100644 --- a/apps/app/services/integration/index.ts +++ b/apps/app/services/integration/index.ts @@ -43,8 +43,12 @@ class IntegrationService extends APIService { }); } - async deleteImporterService(workspaceSlug: string, importerId: string): Promise { - return this.delete(`/api/workspaces/${workspaceSlug}/importers/${importerId}/`) + async deleteImporterService( + workspaceSlug: string, + service: string, + importerId: string + ): Promise { + return this.delete(`/api/workspaces/${workspaceSlug}/importers/${service}/${importerId}/`) .then((res) => res?.data) .catch((error) => { throw error?.response?.data;