mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-03-28 17:42:57 +01:00
Related to #1323 changeRank is called after the end of ajax call
Before the changeRank function was called in then() after changeParent. Now it is called in case of success in the changeParent ajax call
This commit is contained in:
@@ -217,14 +217,14 @@ function applyMove(event) {
|
||||
function moveNode(node, rank, parent) {
|
||||
return new Promise ((res, rej) => {
|
||||
if (parent != null) {
|
||||
changeParent(node, parent).then(changeRank(node, rank)).then(() => res()).catch(() => rej())
|
||||
changeParent(node, parent, rank).then(() => res()).catch(() => rej())
|
||||
} else if (rank != null) {
|
||||
changeRank(node, rank).then(() => res()).catch(() => rej())
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function changeParent(node, parent) {
|
||||
function changeParent(node, parent, rank) {
|
||||
return new Promise((res, rej) => {
|
||||
jQuery.ajax({
|
||||
url: "ws.php?format=json&method=pwg.categories.move",
|
||||
@@ -237,6 +237,7 @@ function changeParent(node, parent) {
|
||||
success: function (raw_data) {
|
||||
data = jQuery.parseJSON(raw_data);
|
||||
if (data.stat === "ok") {
|
||||
changeRank(node, rank)
|
||||
res();
|
||||
} else {
|
||||
rej(raw_data);
|
||||
|
||||
Reference in New Issue
Block a user