Fix empty successful response handling for actions
This commit is contained in:
@@ -31,11 +31,13 @@ class ActionsMenu {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
action.running = true;
|
action.running = true;
|
||||||
actionsManager.executeAction(action, extension, $scope.item, function(response){
|
actionsManager.executeAction(action, extension, $scope.item, (response, error) => {
|
||||||
if(!response) {
|
if(error) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
action.running = false;
|
action.running = false;
|
||||||
$scope.handleActionResponse(action, response);
|
$scope.handleActionResponse(action, response);
|
||||||
|
|
||||||
|
|||||||
@@ -54,10 +54,10 @@ class ActionsManager {
|
|||||||
|
|
||||||
async executeAction(action, extension, item, callback) {
|
async executeAction(action, extension, item, callback) {
|
||||||
|
|
||||||
var customCallback = (response) => {
|
var customCallback = (response, error) => {
|
||||||
action.running = false;
|
action.running = false;
|
||||||
this.$timeout(() => {
|
this.$timeout(() => {
|
||||||
callback(response);
|
callback(response, error);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,11 +127,10 @@ class ActionsManager {
|
|||||||
action.error = false;
|
action.error = false;
|
||||||
handleResponseDecryption(response, await this.authManager.keys(), true);
|
handleResponseDecryption(response, await this.authManager.keys(), true);
|
||||||
}, (response) => {
|
}, (response) => {
|
||||||
if(response && response.error) {
|
let error = (response && response.error) || {message: "An issue occurred while processing this action. Please try again."}
|
||||||
alert("An issue occurred while processing this action. Please try again.");
|
alert(error.message);
|
||||||
}
|
|
||||||
action.error = true;
|
action.error = true;
|
||||||
customCallback(null);
|
customCallback(null, error);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -142,9 +141,10 @@ class ActionsManager {
|
|||||||
action.error = false;
|
action.error = false;
|
||||||
handleResponseDecryption(response, await this.authManager.keys(), false);
|
handleResponseDecryption(response, await this.authManager.keys(), false);
|
||||||
}, (response) => {
|
}, (response) => {
|
||||||
alert("An issue occurred while processing this action. Please try again.");
|
let error = (response && response.error) || {message: "An issue occurred while processing this action. Please try again."}
|
||||||
|
alert(error.message);
|
||||||
action.error = true;
|
action.error = true;
|
||||||
customCallback(null);
|
customCallback(null, error);
|
||||||
})
|
})
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|||||||
8
package-lock.json
generated
8
package-lock.json
generated
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "standard-notes-web",
|
"name": "standard-notes-web",
|
||||||
"version": "3.0.10-beta1",
|
"version": "3.0.10-beta2",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -5724,9 +5724,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"snjs": {
|
"snjs": {
|
||||||
"version": "0.2.5",
|
"version": "0.2.6",
|
||||||
"resolved": "https://registry.npmjs.org/snjs/-/snjs-0.2.5.tgz",
|
"resolved": "https://registry.npmjs.org/snjs/-/snjs-0.2.6.tgz",
|
||||||
"integrity": "sha512-HFjUD9tvVp5VN6ACmKxTlvpvhBTrLj5t8TSR6tPMOHtCU/ozpmuRgD0RFYfOhUYE5bY1woXC/YFR/Nl77oib3Q==",
|
"integrity": "sha512-nBWwzNcOKtCj6Z0f0buD/vswd3agU+sI2KHWQuUn1tuhNoGdzh20DgjcmxEEmW7QiiEkvZHDL/TC8N47tx66SQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"source-map": {
|
"source-map": {
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
"mocha": "^5.2.0",
|
"mocha": "^5.2.0",
|
||||||
"serve-static": "^1.13.2",
|
"serve-static": "^1.13.2",
|
||||||
"sn-stylekit": "2.0.15",
|
"sn-stylekit": "2.0.15",
|
||||||
"snjs": "0.2.5",
|
"snjs": "0.2.6",
|
||||||
"standard-file-js": "0.3.63"
|
"standard-file-js": "0.3.63"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user