Action manager handle error callback
This commit is contained in:
@@ -50,13 +50,18 @@ export class ActionsManager {
|
|||||||
item_uuid: item.uuid
|
item_uuid: item.uuid
|
||||||
};
|
};
|
||||||
const emptyFunc = () => { };
|
const emptyFunc = () => { };
|
||||||
return this.httpManager.getAbsolute(extension.url, params, emptyFunc).then((response) => {
|
return this.httpManager.getAbsolute(
|
||||||
|
extension.url,
|
||||||
|
params,
|
||||||
|
emptyFunc,
|
||||||
|
emptyFunc
|
||||||
|
).then((response) => {
|
||||||
this.updateExtensionFromRemoteResponse(extension, response);
|
this.updateExtensionFromRemoteResponse(extension, response);
|
||||||
return extension;
|
return extension;
|
||||||
}).catch((response) => {
|
}).catch((response) => {
|
||||||
console.error("Error loading extension", response);
|
console.error("Error loading extension", response);
|
||||||
return null;
|
return null;
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
updateExtensionFromRemoteResponse(extension, response) {
|
updateExtensionFromRemoteResponse(extension, response) {
|
||||||
@@ -160,9 +165,15 @@ export class ActionsManager {
|
|||||||
const itemParams = await this.outgoingParamsForItem(item, extension, decrypted);
|
const itemParams = await this.outgoingParamsForItem(item, extension, decrypted);
|
||||||
const params = {
|
const params = {
|
||||||
items: [itemParams]
|
items: [itemParams]
|
||||||
}
|
};
|
||||||
|
/* Needed until SNJS detects null function */
|
||||||
const emptyFunc = () => { };
|
const emptyFunc = () => { };
|
||||||
return this.httpManager.postAbsolute(action.url, params, emptyFunc).then((response) => {
|
return this.httpManager.postAbsolute(
|
||||||
|
action.url,
|
||||||
|
params,
|
||||||
|
emptyFunc,
|
||||||
|
emptyFunc
|
||||||
|
).then((response) => {
|
||||||
action.error = false;
|
action.error = false;
|
||||||
return {response: response};
|
return {response: response};
|
||||||
}).catch((response) => {
|
}).catch((response) => {
|
||||||
@@ -184,9 +195,10 @@ export class ActionsManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async handleGetAction(action) {
|
async handleGetAction(action) {
|
||||||
|
/* Needed until SNJS detects null function */
|
||||||
const emptyFunc = () => {};
|
const emptyFunc = () => {};
|
||||||
const onConfirm = async () => {
|
const onConfirm = async () => {
|
||||||
return this.httpManager.getAbsolute(action.url, {}, emptyFunc)
|
return this.httpManager.getAbsolute(action.url, {}, emptyFunc, emptyFunc)
|
||||||
.then(async (response) => {
|
.then(async (response) => {
|
||||||
action.error = false;
|
action.error = false;
|
||||||
await this.decryptResponse(response, await this.authManager.keys());
|
await this.decryptResponse(response, await this.authManager.keys());
|
||||||
@@ -221,8 +233,14 @@ export class ActionsManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async handleRenderAction(action) {
|
async handleRenderAction(action) {
|
||||||
|
/* Needed until SNJS detects null function */
|
||||||
const emptyFunc = () => {};
|
const emptyFunc = () => {};
|
||||||
return this.httpManager.getAbsolute(action.url, {}, emptyFunc).then(async (response) => {
|
return this.httpManager.getAbsolute(
|
||||||
|
action.url,
|
||||||
|
{},
|
||||||
|
emptyFunc,
|
||||||
|
emptyFunc
|
||||||
|
).then(async (response) => {
|
||||||
action.error = false;
|
action.error = false;
|
||||||
const result = await this.decryptResponse(response, await this.authManager.keys());
|
const result = await this.decryptResponse(response, await this.authManager.keys());
|
||||||
const item = this.modelManager.createItem(result.item);
|
const item = this.modelManager.createItem(result.item);
|
||||||
|
|||||||
2
dist/javascripts/app.js
vendored
2
dist/javascripts/app.js
vendored
File diff suppressed because one or more lines are too long
2
dist/javascripts/app.js.map
vendored
2
dist/javascripts/app.js.map
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user