Handle invalid RS auth tokens

This commit is contained in:
2017-12-31 13:35:25 +01:00
parent ab637deb33
commit ab9ad2f354
3 changed files with 36 additions and 2 deletions

View File

@@ -1,6 +1,7 @@
import EmberObject from '@ember/object';
import { computed, observer } from '@ember/object';
import Service from '@ember/service';
import { computed, observer } from '@ember/object';
import { isEmpty } from '@ember/utils';
import RemoteStorage from 'npm:remotestoragejs';
import Widget from 'npm:remotestorage-widget';
import simpleContentType from 'inspektor/utils/simple-content-type';
@@ -11,6 +12,7 @@ export default Service.extend({
widget: null,
connecting: true,
connected: false,
unauthorized: false,
userAddress: null,
disconnected: computed.not('connected'),
client: null,
@@ -101,6 +103,8 @@ export default Service.extend({
let items = [];
return this.get('client').getListing(path).then(listing => {
if (isEmpty(listing)) { return []; }
Object.keys(listing).forEach(name => {
let item = listing[name];
let type = item['Content-Type'] || 'folder';