From b9ac25ef42ce572ae05cf92094c80e5185fde8b3 Mon Sep 17 00:00:00 2001 From: Mauricio Siu <47042324+Siumauricio@users.noreply.github.com> Date: Sun, 4 May 2025 21:06:34 -0600 Subject: [PATCH] Refactor schedule run handling in ShowSchedules component - Simplified the schedule run logic by directly displaying a success toast upon execution. - Removed redundant error handling for schedule runs, streamlining the code for better readability and maintainability. --- .../application/schedules/show-schedules.tsx | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/apps/dokploy/components/dashboard/application/schedules/show-schedules.tsx b/apps/dokploy/components/dashboard/application/schedules/show-schedules.tsx index 89fa7295..bb62eb3e 100644 --- a/apps/dokploy/components/dashboard/application/schedules/show-schedules.tsx +++ b/apps/dokploy/components/dashboard/application/schedules/show-schedules.tsx @@ -162,20 +162,16 @@ export const ShowSchedules = ({ id, scheduleType = "application" }: Props) => { size="icon" isLoading={isLoading} onClick={async () => { + toast.success("Schedule run successfully"); + await runManually({ scheduleId: schedule.scheduleId, - }) - .then(async () => { - toast.success("Schedule run successfully"); - - await new Promise((resolve) => - setTimeout(resolve, 1500), - ); - refetchSchedules(); - }) - .catch(() => { - toast.error("Error running schedule:"); - }); + }).then(async () => { + await new Promise((resolve) => + setTimeout(resolve, 1500), + ); + refetchSchedules(); + }); }} >