1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-08-07 06:25:23 +02:00

better trello ajax error handling

This commit is contained in:
Harvey Kandola 2016-05-17 12:54:16 -07:00
parent 912e321cd9
commit 60b4b21467

View file

@ -83,20 +83,15 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
self.set('config.lists', lists);
self.set('waiting', false);
},
function(error) {
self.set('waiting', false);
self.set('authenticated', false);
self.showNotification("Unable to fetch board lists");
console.log(error);
});
},
// getListCards() {
// let self = this;
// let list = this.get('config.list');
// Trello.get(`lists/${list.id}/cards`,
// function(cards) {
// self.set('config.cards', cards);
// console.log(cards);
// });
// },
actions: {
isDirty() {
return this.get('isDirty');
@ -145,15 +140,25 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
success: function() {
self.set('authenticated', true);
self.set('config.token', Trello.token());
self.set('waiting', true);
Trello.get("members/me/boards?fields=id,name,url,closed,prefs,idOrganization",
function(boards) {
self.set('waiting', false);
self.set('boards', boards.filterBy("closed", false));
self.getBoardLists();
});
},
function(error) {
self.set('waiting', false);
self.set('authenticated', false);
self.showNotification("Unable to fetch boards");
console.log(error);
}
);
},
error: function(error) {
self.set('waiting', false);
self.set('authenticated', false);
self.showNotification("Unable to authenticate");
console.log(error);
}
@ -185,7 +190,6 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
this.get('sectionService').fetch(page, "cards", this.get('config'))
.then(function(response) {
console.log(response);
meta.set('rawBody', JSON.stringify(response));
self.set('waiting', false);
self.attrs.onAction(page, meta);