Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame^] | 1 | 'use strict' |
| 2 | import {IAppConfigurtaion, IApi} from "../models/app-config"; |
| 3 | |
| 4 | interface IConfigurationUiService { |
| 5 | getConfigurationUi():ng.IPromise<any>; |
| 6 | } |
| 7 | |
| 8 | export class ConfigurationUiService implements IConfigurationUiService { |
| 9 | |
| 10 | static '$inject' = ['$http', '$q', 'sdcConfig']; |
| 11 | private api:IApi; |
| 12 | |
| 13 | constructor(private $http:ng.IHttpService, private $q:ng.IQService, sdcConfig:IAppConfigurtaion) { |
| 14 | this.api = sdcConfig.api; |
| 15 | } |
| 16 | |
| 17 | public getConfigurationUi = ():ng.IPromise<any> => { |
| 18 | let defer = this.$q.defer<any>(); |
| 19 | this.$http.get(this.api.root + this.api.GET_configuration_ui) |
| 20 | .then((result:any) => { |
| 21 | defer.resolve(result.data); |
| 22 | }); |
| 23 | return defer.promise; |
| 24 | } |
| 25 | } |