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:
parent
76e9307449
commit
611cb3b9f9
1 changed files with 5 additions and 0 deletions
|
@ -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);
|
||||||
|
|
Loading…
Reference in a new issue