@@ -162,18 +162,17 @@ const sfc = {
162
162
}
163
163
},
164
164
// rerun a job
165
- rerunJob (idx ) {
165
+ async rerunJob (idx ) {
166
166
const jobLink = ` ${ this .run .link } /jobs/${ idx} ` ;
167
- this .fetch (` ${ jobLink} /rerun` , null , () => {
168
- // The button to rerun job is under "a" tag, so the browser will refresh the page and cancel fetching "rerun".
169
- // However, it should refresh the page because the logs have been reset, or it's another job which has been clicked.
170
- // So we prevent the default behavior and refresh the page after the fetching is done.
171
- window .location .href = jobLink;
172
- });
167
+ await this .fetchPost (` ${ jobLink} /rerun` );
168
+ // The button to rerun job is under "a" tag, so the browser will refresh the page and cancel fetching "rerun".
169
+ // However, it should refresh the page because the logs have been reset, or it's another job which has been clicked.
170
+ // So we prevent the default behavior and refresh the page after the fetching is done.
171
+ window .location .href = jobLink;
173
172
},
174
173
// cancel a run
175
174
cancelRun () {
176
- this .fetch (` ${ this .run .link } /cancel` );
175
+ this .fetchPost (` ${ this .run .link } /cancel` );
177
176
},
178
177
179
178
createLogLine (line ) {
@@ -211,7 +210,7 @@ const sfc = {
211
210
// for example: make cursor=null means the first time to fetch logs, cursor=eof means no more logs, etc
212
211
return {step: idx, cursor: it .cursor , expanded: it .expanded };
213
212
});
214
- const resp = await this .fetch (
213
+ const resp = await this .fetchPost (
215
214
` ${ this .actionsURL } /runs/${ this .runIndex } /jobs/${ this .jobIndex } ` ,
216
215
JSON .stringify ({logCursors}),
217
216
);
@@ -251,18 +250,14 @@ const sfc = {
251
250
}
252
251
},
253
252
254
- fetch (url , body , callback ) {
253
+ fetchPost (url , body ) {
255
254
return fetch (url, {
256
255
method: ' POST' ,
257
256
headers: {
258
257
' Content-Type' : ' application/json' ,
259
258
' X-Csrf-Token' : csrfToken,
260
259
},
261
260
body,
262
- }).finally (() => {
263
- if (callback) {
264
- callback ();
265
- }
266
261
});
267
262
},
268
263
},
0 commit comments