Safetydance is not browser compat
This commit is contained in:
@@ -72,7 +72,6 @@
|
||||
|
||||
<script>
|
||||
|
||||
import safe from 'safetydance';
|
||||
import superagent from 'superagent';
|
||||
|
||||
import Button from 'primevue/button';
|
||||
@@ -291,9 +290,15 @@ export default {
|
||||
useConfirm();
|
||||
|
||||
// load all apps
|
||||
let [error, result] = await safe(superagent.get(`${this.apiOrigin}/api/v1/apps`).query({ access_token: this.accessToken }));
|
||||
if (error) {
|
||||
console.error('Failed to list apps', error);
|
||||
let error, result;
|
||||
try {
|
||||
result = await superagent.get(`${this.apiOrigin}/api/v1/apps`).query({ access_token: this.accessToken });
|
||||
} catch (e) {
|
||||
error = e;
|
||||
}
|
||||
|
||||
if (error || result.statusCode !== 200) {
|
||||
console.error('Failed to list apps', error || result.statusCode);
|
||||
this.apps = [];
|
||||
} else {
|
||||
this.apps = result.body ? result.body.apps.filter(a => !!a.manifest.addons.localstorage) : [];
|
||||
@@ -301,9 +306,14 @@ export default {
|
||||
this.apps.forEach(function (a) { a.type = 'app'; a.label = a.fqdn; });
|
||||
|
||||
// load all volumes
|
||||
[error, result] = await safe(superagent.get(`${this.apiOrigin}/api/v1/volumes`).query({ access_token: this.accessToken }));
|
||||
if (error) {
|
||||
console.error('Failed to list volumes', error);
|
||||
try {
|
||||
result = await superagent.get(`${this.apiOrigin}/api/v1/volumes`).query({ access_token: this.accessToken });
|
||||
} catch (e) {
|
||||
error = e;
|
||||
}
|
||||
|
||||
if (error || result.statusCode !== 200) {
|
||||
console.error('Failed to list volumes', error || result.statusCode);
|
||||
this.volumes = [];
|
||||
} else {
|
||||
this.volumes = result.body ? result.body.volumes : [];
|
||||
@@ -335,6 +345,11 @@ export default {
|
||||
this.activeResource = this.apps[0];
|
||||
}
|
||||
|
||||
if (!this.activeResource) {
|
||||
console.error('Not able to load apps or volumes. Cannot continue');
|
||||
return;
|
||||
}
|
||||
|
||||
this.cwd = sanitize('/' + (this.$route.params.cwd ? this.$route.params.cwd.join('/') : '/'));
|
||||
|
||||
this.loadResource(this.activeResource);
|
||||
|
||||
Reference in New Issue
Block a user