diff --git a/apps/dashboard/src/main.tsx b/apps/dashboard/src/main.tsx index 259d0e8e755..f91dd4abd99 100644 --- a/apps/dashboard/src/main.tsx +++ b/apps/dashboard/src/main.tsx @@ -148,15 +148,15 @@ const router = createBrowserRouter([ children: [ { path: ROUTES.INTEGRATIONS_CONNECT, - element: history.back()} />, + element: , }, { path: ROUTES.INTEGRATIONS_CONNECT_PROVIDER, - element: history.back()} />, + element: , }, { path: ROUTES.INTEGRATIONS_UPDATE, - element: history.back()} />, + element: , }, ], }, diff --git a/apps/dashboard/src/pages/integrations/components/create-integration-sidebar.tsx b/apps/dashboard/src/pages/integrations/components/create-integration-sidebar.tsx index 5cede5f38c9..83f800308f4 100644 --- a/apps/dashboard/src/pages/integrations/components/create-integration-sidebar.tsx +++ b/apps/dashboard/src/pages/integrations/components/create-integration-sidebar.tsx @@ -17,10 +17,9 @@ import { buildRoute, ROUTES } from '../../../utils/routes'; export type CreateIntegrationSidebarProps = { isOpened: boolean; - onClose: () => void; }; -export function CreateIntegrationSidebar({ isOpened, onClose }: CreateIntegrationSidebarProps) { +export function CreateIntegrationSidebar({ isOpened }: CreateIntegrationSidebarProps) { const navigate = useNavigate(); const { providerId } = useParams(); @@ -79,15 +78,14 @@ export function CreateIntegrationSidebar({ isOpened, onClose }: CreateIntegratio await setPrimaryIntegration({ integrationId: integration.data._id }); } - onClose(); - } catch (error: any) { + navigate(ROUTES.INTEGRATIONS); + } catch (error: unknown) { handleIntegrationError(error, 'create'); } } const handleClose = () => { - onClose(); - navigate('/integrations'); + navigate(ROUTES.INTEGRATIONS); }; return ( diff --git a/apps/dashboard/src/pages/integrations/components/update-integration-sidebar.tsx b/apps/dashboard/src/pages/integrations/components/update-integration-sidebar.tsx index 6351163885d..c1db8ddb66c 100644 --- a/apps/dashboard/src/pages/integrations/components/update-integration-sidebar.tsx +++ b/apps/dashboard/src/pages/integrations/components/update-integration-sidebar.tsx @@ -18,10 +18,9 @@ import { ROUTES } from '../../../utils/routes'; type UpdateIntegrationSidebarProps = { isOpened: boolean; - onClose: () => void; }; -export function UpdateIntegrationSidebar({ isOpened, onClose }: UpdateIntegrationSidebarProps) { +export function UpdateIntegrationSidebar({ isOpened }: UpdateIntegrationSidebarProps) { const navigate = useNavigate(); const { integrationId } = useParams(); const { integrations } = useFetchIntegrations(); @@ -96,7 +95,7 @@ export function UpdateIntegrationSidebar({ isOpened, onClose }: UpdateIntegratio await setPrimaryIntegration({ integrationId: integration._id }); } - onClose(); + navigate(ROUTES.INTEGRATIONS); } catch (error: unknown) { handleIntegrationError(error, 'update'); } @@ -107,16 +106,16 @@ export function UpdateIntegrationSidebar({ isOpened, onClose }: UpdateIntegratio try { await deleteIntegration({ id: integration._id }); + toast.success('Integration deleted successfully'); setIsDeleteDialogOpen(false); - onClose(); + navigate(ROUTES.INTEGRATIONS); } catch (error: unknown) { handleIntegrationError(error, 'delete'); } }; const handleClose = () => { - onClose(); navigate(ROUTES.INTEGRATIONS); }; @@ -132,7 +131,7 @@ export function UpdateIntegrationSidebar({ isOpened, onClose }: UpdateIntegratio integration={integration} onSubmit={handleSubmitWithPrimaryCheck} mode="update" - hasOtherProviders={hasOtherProviders} + hasOtherProviders={!!hasOtherProviders} />