Skip to content

Commit f61cc81

Browse files
committed
fix promise
1 parent 8beded8 commit f61cc81

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

web_src/js/features/repo-issue.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ function initRepoIssueWipTitle() {
333333
}
334334

335335
function updateIssuesMeta(url, action, issueIds, elementId) {
336-
return new Promise((resolve) => {
336+
return new Promise((resolve, reject) => {
337337
$.ajax({
338338
type: 'POST',
339339
url,
@@ -343,7 +343,8 @@ function updateIssuesMeta(url, action, issueIds, elementId) {
343343
issue_ids: issueIds,
344344
id: elementId,
345345
},
346-
success: resolve
346+
success: resolve,
347+
error: reject,
347348
});
348349
});
349350
}

web_src/js/features/repo-legacy.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ function initRepoCommentForm() {
5353

5454
if (editMode === 'true') {
5555
const form = $('#update_issueref_form');
56-
$.post(form.attr('action'), {_csrf: csrf, ref: selectedValue}, window.location.reload);
56+
$.post(form.attr('action'), {_csrf: csrf, ref: selectedValue}, () => window.location.reload());
5757
} else if (editMode === '') {
5858
$selectBranch.find('.ui .branch-name').text(selectedValue);
5959
}
@@ -94,7 +94,7 @@ function initRepoCommentForm() {
9494
);
9595
promises.push(promise);
9696
});
97-
Promise.all(promises).then(window.location.reload);
97+
Promise.all(promises).then(() => window.location.reload());
9898
}
9999
});
100100

@@ -166,7 +166,7 @@ function initRepoCommentForm() {
166166
'clear',
167167
$listMenu.data('issue-id'),
168168
'',
169-
).then(window.location.reload);
169+
).then(() => window.location.reload());
170170
}
171171

172172
$(this).parent().find('.item').each(function () {
@@ -209,7 +209,7 @@ function initRepoCommentForm() {
209209
'',
210210
$menu.data('issue-id'),
211211
$(this).data('id'),
212-
).then(window.location.reload);
212+
).then(() => window.location.reload());
213213
}
214214

215215
let icon = '';
@@ -242,7 +242,7 @@ function initRepoCommentForm() {
242242
'',
243243
$menu.data('issue-id'),
244244
$(this).data('id'),
245-
).then(window.location.reload);
245+
).then(() => window.location.reload());
246246
}
247247

248248
$list.find('.selected').html('');

0 commit comments

Comments
 (0)