Skip to content

Commit

Permalink
fix(dashboard): navigate post sync
Browse files Browse the repository at this point in the history
  • Loading branch information
scopsy committed Dec 23, 2024
1 parent 10f71f3 commit b96f85e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion apps/dashboard/src/hooks/use-sync-workflow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@ import { WorkflowOriginEnum, WorkflowStatusEnum } from '@novu/shared';
import { useMutation } from '@tanstack/react-query';
import { useMemo, useState } from 'react';
import { toast } from 'sonner';
import { useNavigate } from 'react-router-dom';
import { buildRoute, ROUTES } from '@/utils/routes';

export function useSyncWorkflow(workflow: WorkflowResponseDto | WorkflowListResponseDto) {
const { currentEnvironment, oppositeEnvironment, switchEnvironment } = useEnvironment();
const [isLoading, setIsLoading] = useState(false);
const [showConfirmModal, setShowConfirmModal] = useState(false);
const navigate = useNavigate();

let loadingToast: string | number | undefined = undefined;

Expand Down Expand Up @@ -79,7 +82,10 @@ export function useSyncWorkflow(workflow: WorkflowResponseDto | WorkflowListResp
actionLabel={`Switch to ${environment?.name}`}
onAction={() => {
close();
switchEnvironment(environment?.slug || '');
const targetSlug = environment?.slug || '';
switchEnvironment(targetSlug);

navigate(buildRoute(ROUTES.WORKFLOWS, { environmentSlug: targetSlug }));
}}
onClose={close}
/>
Expand Down

0 comments on commit b96f85e

Please sign in to comment.