2016-06-19 19:16:40 +02:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const api = require('../api.js');
|
2016-07-30 13:35:19 +02:00
|
|
|
const Post = require('./post.js');
|
2016-06-19 19:16:40 +02:00
|
|
|
|
|
|
|
class Info {
|
|
|
|
static get() {
|
|
|
|
return api.get('/info')
|
|
|
|
.then(response => {
|
2016-07-30 13:35:19 +02:00
|
|
|
if (response.featuredPost) {
|
|
|
|
response.featuredPost =
|
|
|
|
Post.fromResponse(response.featuredPost);
|
|
|
|
}
|
2016-06-19 19:16:40 +02:00
|
|
|
return Promise.resolve(response);
|
|
|
|
}, response => {
|
|
|
|
return Promise.reject(response.errorMessage);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = Info;
|