mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
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.
This commit is contained in:
@@ -162,20 +162,16 @@ export const ShowSchedules = ({ id, scheduleType = "application" }: Props) => {
|
|||||||
size="icon"
|
size="icon"
|
||||||
isLoading={isLoading}
|
isLoading={isLoading}
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
|
toast.success("Schedule run successfully");
|
||||||
|
|
||||||
await runManually({
|
await runManually({
|
||||||
scheduleId: schedule.scheduleId,
|
scheduleId: schedule.scheduleId,
|
||||||
})
|
}).then(async () => {
|
||||||
.then(async () => {
|
await new Promise((resolve) =>
|
||||||
toast.success("Schedule run successfully");
|
setTimeout(resolve, 1500),
|
||||||
|
);
|
||||||
await new Promise((resolve) =>
|
refetchSchedules();
|
||||||
setTimeout(resolve, 1500),
|
});
|
||||||
);
|
|
||||||
refetchSchedules();
|
|
||||||
})
|
|
||||||
.catch(() => {
|
|
||||||
toast.error("Error running schedule:");
|
|
||||||
});
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Play className="size-4 transition-colors" />
|
<Play className="size-4 transition-colors" />
|
||||||
|
|||||||
Reference in New Issue
Block a user