From 8733ac0770aab10231b59d0398acd33765936247 Mon Sep 17 00:00:00 2001 From: Danijel Anđelković Date: Thu, 14 Apr 2022 00:16:50 +0200 Subject: Dodao servis za citanje konfiguracije tako da moze da se promeni u buildovanoj angular aplikaciji. --- frontend/src/app/_services/predictors.service.ts | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'frontend/src/app/_services/predictors.service.ts') diff --git a/frontend/src/app/_services/predictors.service.ts b/frontend/src/app/_services/predictors.service.ts index 909d1a49..9e8383aa 100644 --- a/frontend/src/app/_services/predictors.service.ts +++ b/frontend/src/app/_services/predictors.service.ts @@ -1,7 +1,7 @@ import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { Observable } from 'rxjs'; -import API_SETTINGS from '../../config.json'; +import { Configuration } from '../configuration.service'; import Predictor from '../_data/Predictor'; import { Column } from '../_pages/predict/predict.component'; import { AuthService } from './auth.service'; @@ -10,27 +10,24 @@ import { AuthService } from './auth.service'; providedIn: 'root' }) export class PredictorsService { - - - constructor(private http: HttpClient, private authService: AuthService) { } getPublicPredictors(): Observable { - return this.http.get(`${API_SETTINGS.apiURL}/predictor/publicpredictors`, { headers: this.authService.authHeader() }); + return this.http.get(`${Configuration.settings.apiURL}/predictor/publicpredictors`, { headers: this.authService.authHeader() }); } getPredictor(id: String): Observable { - return this.http.get(`${API_SETTINGS.apiURL}/predictor/getpredictor/` + id, { headers: this.authService.authHeader() }); + return this.http.get(`${Configuration.settings.apiURL}/predictor/getpredictor/` + id, { headers: this.authService.authHeader() }); } usePredictor(predictor: Predictor, inputs: Column[]) { - return this.http.post(`${API_SETTINGS.apiURL}/predictor/usepredictor/` + predictor._id, inputs, { headers: this.authService.authHeader() }); + return this.http.post(`${Configuration.settings.apiURL}/predictor/usepredictor/` + predictor._id, inputs, { headers: this.authService.authHeader() }); } deletePredictor(predictor: Predictor) { - return this.http.delete(`${API_SETTINGS.apiURL}/predictor/` + predictor.name, { headers: this.authService.authHeader(), responseType: "text" }); + return this.http.delete(`${Configuration.settings.apiURL}/predictor/` + predictor.name, { headers: this.authService.authHeader(), responseType: "text" }); } getMyPredictors(): Observable { - return this.http.get(`${API_SETTINGS.apiURL}/predictor/mypredictors`, { headers: this.authService.authHeader() }); + return this.http.get(`${Configuration.settings.apiURL}/predictor/mypredictors`, { headers: this.authService.authHeader() }); } } -- cgit v1.2.3