Skip to content

Commit 8e1c125

Browse files
committed
refactor(series/info.html): simplify code for Promise creation in prototype.
1 parent b550532 commit 8e1c125

File tree

1 file changed

+14
-10
lines changed
  • src/main/webapp/WEB-INF/views/series

1 file changed

+14
-10
lines changed

src/main/webapp/WEB-INF/views/series/info.html

+14-10
Original file line numberDiff line numberDiff line change
@@ -956,11 +956,13 @@ <h5 th:text="#{t_add_info_who_selling_series}">Add info about selling/buying thi
956956

957957
responseCount++;
958958

959-
return new Promise(function delayExecution(resolve) {
960-
setTimeout(resolve, 500 /* 0.5 second */);
961-
962-
}).then(function returnResponse() {
963-
return stubResponse.status == 500 ? Promise.reject(stubResponse) : Promise.resolve(stubResponse);
959+
return new Promise(function delayExecution(resolve, reject) {
960+
setTimeout(
961+
function returnResponse() {
962+
stubResponse.status == 500 ? reject(stubResponse) : resolve(stubResponse);
963+
},
964+
500 /* 0.5 second */
965+
);
964966
});
965967
},
966968
patch: function (url) {
@@ -999,11 +1001,13 @@ <h5 th:text="#{t_add_info_who_selling_series}">Add info about selling/buying thi
9991001

10001002
responseCount++;
10011003

1002-
return new Promise(function delayExecution(resolve) {
1003-
setTimeout(resolve, 500 /* 0.5 second */);
1004-
1005-
}).then(function returnResponse() {
1006-
return stubResponse.status == 500 ? Promise.reject(stubResponse) : Promise.resolve(stubResponse);
1004+
return new Promise(function delayExecution(resolve, reject) {
1005+
setTimeout(
1006+
function returnResponse() {
1007+
stubResponse.status == 500 ? reject(stubResponse) : resolve(stubResponse);
1008+
},
1009+
500 /* 0.5 second */
1010+
);
10071011
});
10081012
},
10091013
get: function (url) {

0 commit comments

Comments
 (0)