Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

if there is a good response, log to console and tell user when something went wrong

Vincent5fccb62bce44
diff --git a/ui/component/or-asset-viewer/src/index.ts b/ui/component/or-asset-viewer/src/index.ts
index 3e8247ab5..550382493 100644
--- a/ui/component/or-asset-viewer/src/index.ts
+++ b/ui/component/or-asset-viewer/src/index.ts
@@ -406,8 +406,17 @@ export function getPanelContent(panelName: string, asset: Asset, attributes: { [
contents: encoded,
binary: true
} as FileInfo
+
manager.rest.api.AgentResource.doProtocolAssetImport(asset.id!, fileInfo) //todo: this doesn't work yet
- .then(response => console.log(response.data, response)); //todo: do something with this response
+ .then(response => {
+ if (response.status !== 200) {
+ showSnackbar(undefined, "Something went wrong, please try again", i18next.t("dismiss"));
+ } else {
+ console.info(response.data, response) //todo: do something with this response
+ }
+ })
+ .catch(() => showSnackbar(undefined, "Something went wrong, please try again", i18next.t("dismiss")));
+
}
}
}