ns2-front-module-common
Version: 
NS2 common module
39 lines • 1.42 kB
JavaScript
import { Injectable } from '@angular/core';
import { HttpService } from './http.service';
var ArticlesService = (function () {
    function ArticlesService(httpService) {
        this.httpService = httpService;
    }
    /**
     * Получение статей по трейлу топика
     * @param {string} topicTrail Полное имя топика
     * @returns {Promise<ArticleModel[]>}
     */
    ArticlesService.prototype.getArticlesByTopicTrail = function (topicTrail) {
        var _this = this;
        return new Promise(function (resolve, reject) {
            var url = _this.contentEndPoint + "article/tree-by-trail/" + topicTrail;
            _this.httpService.get(url)
                .map(function (response) { return response.json(); })
                .map(function (response) { return response.data; })
                .subscribe(resolve, reject);
        });
    };
    /**
     * Установка base url до микросервиса контент
     * @param {string} endPoint
     */
    ArticlesService.prototype.setContentEndPoint = function (endPoint) {
        this.contentEndPoint = endPoint;
    };
    return ArticlesService;
}());
export { ArticlesService };
ArticlesService.decorators = [
    { type: Injectable },
];
/** @nocollapse */
ArticlesService.ctorParameters = function () { return [
    { type: HttpService, },
]; };
//# sourceMappingURL=articles.service.js.map