Skip to content

Commit 736fccb

Browse files
authored
Fix tags fetch
1 parent c2e3577 commit 736fccb

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

app/core/helpers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ define(['handlebars', 'moment', 'core/origin'], function(Handlebars, Moment, Ori
357357
if(header) {
358358
header.split(',').forEach(l => {
359359
const [url, name] = l.split(';');
360-
if (!url || !name) return console.trace(`Could not parse links: ${link}`);
360+
if (!url || !name) return console.error(`Could not parse links: ${l}`);
361361
links[name.replace(/rel="(.*)"/, '$1').trim()] = url.replace(/<(.*)>/, '$1').trim();
362362
});
363363
}

app/modules/projects/index.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ define(function(require) {
66
var ContentCollection = require('core/collections/contentCollection');
77
var TagsCollection = require('core/collections/tagsCollection');
88

9-
Origin.on('router:projects', function(location, subLocation, action) {
9+
Origin.on('router:projects', async function(location, subLocation, action) {
1010
Origin.trigger('editor:resetData');
1111
Origin.contentHeader.setButtons(Origin.contentHeader.BUTTON_TYPES.OPTIONS, [
1212
{
@@ -45,13 +45,15 @@ define(function(require) {
4545
group: 'sort'
4646
}
4747
]);
48-
(new TagsCollection()).fetch({
49-
success: function(collection) {
50-
Origin.sidebar.addView(new ProjectsSidebarView({ collection }).$el);
51-
Origin.trigger('dashboard:loaded', { type: location || 'all', tags: collection });
52-
},
53-
error: () => console.log('Error occured getting the tags collection - try refreshing your page')
54-
});
48+
try {
49+
const collection = new TagsCollection()
50+
await collection.fetch();
51+
Origin.sidebar.addView(new ProjectsSidebarView({ collection }).$el);
52+
Origin.trigger('dashboard:loaded', { type: location || 'all', tags: collection });
53+
} catch(e) {
54+
console.log('Error occured getting the tags collection - try refreshing your page');
55+
console.log(e);
56+
}
5557
});
5658

5759
Origin.on('dashboard:loaded', function ({ type, tags }) {

0 commit comments

Comments
 (0)