diff --git a/angular.json b/angular.json index 3d0d5fe..99f0b35 100644 --- a/angular.json +++ b/angular.json @@ -47,8 +47,8 @@ "budgets": [ { "type": "initial", - "maximumWarning": "500kb", - "maximumError": "1mb" + "maximumWarning": "4mb", + "maximumError": "5mb" }, { "type": "anyComponentStyle", diff --git a/src/app/services/gruppe.service.ts b/src/app/services/gruppe.service.ts index e5fd85e..7c94d00 100644 --- a/src/app/services/gruppe.service.ts +++ b/src/app/services/gruppe.service.ts @@ -1,13 +1,15 @@ import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { Gruppe } from '../Gruppe'; +import { environment } from '../../environments/environment'; @Injectable({ providedIn: 'root' }) export class GruppeService { - public $url = "http://localhost/bildungdb/api/group_data.php"; + private API_URL = environment.API_URL; + public $url = this.API_URL + "/api/group_data.php"; strAnfrage =""; constructor(private http: HttpClient) { } diff --git a/src/app/services/kompetenz.service.ts b/src/app/services/kompetenz.service.ts index 049aea9..3192ad3 100644 --- a/src/app/services/kompetenz.service.ts +++ b/src/app/services/kompetenz.service.ts @@ -1,6 +1,7 @@ import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { Kompetenz } from '../kompetenz'; +import { environment } from '../../environments/environment'; // https://angular.de/artikel/angular-tutorial-deutsch/#komponenten-und-services // Umgang mit Asynchronität @@ -12,7 +13,8 @@ import { Kompetenz } from '../kompetenz'; export class KompetenzService { - public $url = "http://localhost/bildungdb/api/kompetenzen.php"; + private API_URL = environment.API_URL; + public $url = this.API_URL + "/api/kompetenzen.php"; strAnfrage?: string; constructor(private http: HttpClient) { } diff --git a/src/app/services/lehrling.service.ts b/src/app/services/lehrling.service.ts index 76a9cbc..33e0779 100644 --- a/src/app/services/lehrling.service.ts +++ b/src/app/services/lehrling.service.ts @@ -2,13 +2,15 @@ import { Injectable } from '@angular/core'; import { HttpClient, HttpParams } from '@angular/common/http'; import { Lehrling } from '../lehrling'; import { map, Observable } from 'rxjs'; +import { environment } from '../../environments/environment'; @Injectable({ providedIn: 'root' }) export class LehrlingService { - public $url = "http://localhost/bildungdb/api/apprentice_list.php"; + private API_URL = environment.API_URL; + public $url = "/api/apprentice_list.php"; constructor(private http: HttpClient) { } getLehrlinge() { diff --git a/src/app/services/login.service.ts b/src/app/services/login.service.ts index 9c07e4c..7cf08f4 100644 --- a/src/app/services/login.service.ts +++ b/src/app/services/login.service.ts @@ -3,6 +3,7 @@ import { Injectable } from '@angular/core'; import { Observable } from 'rxjs'; import { HttpSentEvent } from '@angular/common/http'; import { Userlogin } from '../Userlogin'; +import { environment } from '../../environments/environment'; @Injectable({ providedIn: 'root' @@ -10,7 +11,9 @@ import { Userlogin } from '../Userlogin'; export class LoginService { constructor(private http: HttpClient) { } - baseUrl = "http://localhost/bildungdb/api"; + + private API_URL = environment.API_URL; + baseUrl = this.API_URL + "/api"; login(logindata): any { const strloginapi = this.baseUrl + '/login.php'; diff --git a/src/app/services/modul.service.ts b/src/app/services/modul.service.ts index db4117d..1b45760 100644 --- a/src/app/services/modul.service.ts +++ b/src/app/services/modul.service.ts @@ -1,13 +1,15 @@ import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { _Modul } from '../_Modul'; +import { environment } from '../../environments/environment'; @Injectable({ providedIn: 'root' }) export class ModulService { - public $url = "http://localhost/bildungdb/api/modul.php"; + private API_URL = environment.API_URL; + public $url = this.API_URL + "/api/modul.php"; constructor(private http: HttpClient) { } diff --git a/src/app/services/profession.service.ts b/src/app/services/profession.service.ts index d482125..be9543b 100644 --- a/src/app/services/profession.service.ts +++ b/src/app/services/profession.service.ts @@ -1,13 +1,14 @@ import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { Profession } from '../Profession'; - +import { environment } from '../../environments/environment'; @Injectable({ providedIn: 'root' }) export class ProfessionService { - public $url = "http://localhost/bildungdb/api/profession.php"; + private API_URL = environment.API_URL; + public $url = this.API_URL + "/api/profession.php"; constructor(private http: HttpClient) { } getProfessionList() { diff --git a/src/app/services/pruefung.service.ts b/src/app/services/pruefung.service.ts index 2caf095..351ca20 100644 --- a/src/app/services/pruefung.service.ts +++ b/src/app/services/pruefung.service.ts @@ -1,14 +1,15 @@ import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { Pruefung } from '../Pruefung'; - +import { environment } from '../../environments/environment'; @Injectable({ providedIn: 'root' }) export class PruefungService { - public $url = "http://localhost/bildungdb/api/pruefung.php"; - + private API_URL = environment.API_URL; + public $url = this.API_URL + "/api/pruefung.php"; + constructor(private http: HttpClient) { } getPruefungen() { diff --git a/src/app/services/pruefungsergebnis.service.ts b/src/app/services/pruefungsergebnis.service.ts index 4d3c2bf..71c7ff0 100644 --- a/src/app/services/pruefungsergebnis.service.ts +++ b/src/app/services/pruefungsergebnis.service.ts @@ -1,13 +1,14 @@ import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { Pruefungsergebnis } from '../Pruefungsergebnis'; - +import { environment } from '../../environments/environment'; @Injectable({ providedIn: 'root' }) export class PruefungsergebnisService { - public $url = "http://localhost/bildungdb/api/pruefungsergebnis.php"; + private API_URL = environment.API_URL; + public $url = this.API_URL + "/api/pruefungsergebnis.php"; constructor(private http: HttpClient) { } diff --git a/src/app/services/user.service.ts b/src/app/services/user.service.ts index 0967f85..9b0588a 100644 --- a/src/app/services/user.service.ts +++ b/src/app/services/user.service.ts @@ -2,13 +2,14 @@ import { HttpClient } from '@angular/common/http'; import { EventEmitter, Injectable, Output } from '@angular/core'; import { User } from '../user'; import { map, Observable } from 'rxjs'; - +import { environment } from '../../environments/environment'; @Injectable({ providedIn: 'root' }) export class UserService { - public baseUrl = "http://localhost/bildungdb/api/"; + private API_URL = environment.API_URL; + public baseUrl = this.API_URL + "/api/"; redirectUrl?: string; @@ -17,7 +18,7 @@ export class UserService { constructor(private httpClient : HttpClient) { } public userlogin(username:string, password:string) { - return this.httpClient.post(this.baseUrl + '/login.php', { username, password }) + return this.httpClient.post(this.baseUrl + 'login.php', { username, password }) .pipe(map((Usermodule: { name: string; }[]) => { this.setToken(Usermodule[0].name); this.getLoggedInName.emit(true); @@ -25,7 +26,7 @@ public userlogin(username:string, password:string) { })); } public userregistration(name: string,email: string,pwd: string,login: string) { - return this.httpClient.post(this.baseUrl + '/registration.php', { name,email, pwd,login }) + return this.httpClient.post(this.baseUrl + 'registration.php', { name,email, pwd,login }) .pipe(map(Usermodule => { return Usermodule; })); diff --git a/src/environments/environment.prod.ts b/src/environments/environment.prod.ts index 3612073..b387d19 100644 --- a/src/environments/environment.prod.ts +++ b/src/environments/environment.prod.ts @@ -1,3 +1,4 @@ export const environment = { - production: true + production: true, + API_URL: 'https://bfi.opencloud.at', }; diff --git a/src/environments/environment.ts b/src/environments/environment.ts index f56ff47..e6a67b6 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -3,7 +3,8 @@ // The list of file replacements can be found in `angular.json`. export const environment = { - production: false + production: false, + API_URL: 'http://localhost/bildungdb', }; /*