client/home: fix post not being bound to its model

This resulted in errors while presenting post content control - it tried
to use methods that were available only in the actual model.
This commit is contained in:
rr- 2016-07-30 13:35:19 +02:00
parent 76e9307449
commit 611cb3b9f9

View file

@ -1,11 +1,16 @@
'use strict'; 'use strict';
const api = require('../api.js'); const api = require('../api.js');
const Post = require('./post.js');
class Info { class Info {
static get() { static get() {
return api.get('/info') return api.get('/info')
.then(response => { .then(response => {
if (response.featuredPost) {
response.featuredPost =
Post.fromResponse(response.featuredPost);
}
return Promise.resolve(response); return Promise.resolve(response);
}, response => { }, response => {
return Promise.reject(response.errorMessage); return Promise.reject(response.errorMessage);