Skip to content

Commit 598ff3a

Browse files
stijndeleeuwgeirsagberg
stijndeleeuw
authored andcommitted
Added current date to the query parameter if there is no current scheduleTime provided
fixes #97
1 parent 38d966c commit 598ff3a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

db-scheduler-ui-frontend/src/services/runTask.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,16 @@ const API_BASE_URL: string =
1616
window.location.origin + '/db-scheduler-api';
1717

1818
const runTask = async (id: string, name: string, scheduleTime?:Date) => {
19-
19+
2020
const queryParams = new URLSearchParams();
2121

2222
queryParams.append('id', id);
2323
queryParams.append('name', name);
24-
scheduleTime&&queryParams.append('scheduleTime', scheduleTime.toISOString());
24+
if (scheduleTime) {
25+
queryParams.append('scheduleTime', scheduleTime.toISOString());
26+
} else {
27+
queryParams.append('scheduleTime', new Date().toISOString());
28+
}
2529

2630
const response = await fetch(
2731
`${API_BASE_URL}/tasks/rerun?${queryParams}`,

0 commit comments

Comments
 (0)