harbor-angular
Version:
Harbor shared components based on Clarity and Angular2s
33 lines • 1.34 kB
JavaScript
import { Injectable, Inject } from '@angular/core';
import { Http, RequestOptions, Headers } from '@angular/http';
import 'rxjs/add/operator/toPromise';
import { SERVICE_CONFIG } from '../../service.config';
export var SystemInfoService = (function () {
function SystemInfoService(http, config) {
this.http = http;
this.config = config;
this.httpOptions = new RequestOptions({
headers: new Headers({
"Content-Type": 'application/json'
})
});
}
SystemInfoService.prototype.getSystemInfo = function () {
if (this.config.systemInfoEndpoint.trim() === "") {
return Promise.reject("500: Internal error");
}
return this.http.get(this.config.systemInfoEndpoint, this.httpOptions).toPromise()
.then(function (response) { return response.json(); })
.catch(function (error) { return console.error("Get systeminfo error: ", error); });
};
SystemInfoService.decorators = [
{ type: Injectable },
];
/** @nocollapse */
SystemInfoService.ctorParameters = function () { return [
{ type: Http, },
{ type: undefined, decorators: [{ type: Inject, args: [SERVICE_CONFIG,] },] },
]; };
return SystemInfoService;
}());
//# sourceMappingURL=system-info.service.js.map