返回提交历史
Modified
static/webui/script.js
+28
-18
XFEstudio/SpaceNinjaServer
fix(webui): don't prematurely resolve quest update promises (#4456)
Closes #4455 Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/4456 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
e4b30bf1
代码差异
1 个文件
+28
-18
@@ -4715,33 +4715,43 @@ function doAddCurrency(currency) {
4715
4715
});
4716
4716
}
4717
4717
4718
function doQuestUpdate(operation, itemType) {
4719
revalidateAuthz().then(() => {
4718
async function doQuestUpdate(operation, itemType) {
4719
await revalidateAuthz();
4720
await new Promise(resolve => {
4720
4721
$.post({
4721
4722
url: "/custom/manageQuests?" + window.authz + "&operation=" + operation + "&itemType=" + itemType,
4722
4723
contentType: "application/json"
4723
}).then(function (didAnything) {
4724
if (didAnything) {
4725
updateInventory();
4726
} else {
4727
toast(loc("code_nothingToDo"));
4728
}
4729
});
4724
})
4725
.then(function (didAnything) {
4726
if (didAnything) {
4727
updateInventory();
4728
} else {
4729
toast(loc("code_nothingToDo"));
4730
}
4731
})
4732
.always(() => {
4733
resolve();
4734
});
4730
4735
});
4731
4736
}
4732
4737
4733
function doBulkQuestUpdate(operation) {
4734
revalidateAuthz().then(() => {
4738
async function doBulkQuestUpdate(operation) {
4739
await revalidateAuthz();
4740
await new Promise(resolve => {
4735
4741
$.post({
4736
4742
url: "/custom/manageQuests?" + window.authz + "&operation=" + operation,
4737
4743
contentType: "application/json"
4738
}).then(function (didAnything) {
4739
if (didAnything) {
4740
updateInventory();
4741
} else {
4742
toast(loc("code_nothingToDo"));
4743
}
4744
});
4744
})
4745
.then(function (didAnything) {
4746
if (didAnything) {
4747
updateInventory();
4748
} else {
4749
toast(loc("code_nothingToDo"));
4750
}
4751
})
4752
.always(() => {
4753
resolve();
4754
});
4745
4755
});
4746
4756
}
4747
4757