diff options
author | Danijel Anđelković <adanijel99@gmail.com> | 2022-04-14 00:16:50 +0200 |
---|---|---|
committer | Danijel Anđelković <adanijel99@gmail.com> | 2022-04-14 00:16:50 +0200 |
commit | 8733ac0770aab10231b59d0398acd33765936247 (patch) | |
tree | 1d19233278ce9822c13f5482f96c5e52532fc1b7 /frontend/src/app/_services/auth.service.ts | |
parent | 62939a4639c8bef9c520ac0a30613f16a65f4df1 (diff) |
Dodao servis za citanje konfiguracije tako da moze da se promeni u buildovanoj angular aplikaciji.
Diffstat (limited to 'frontend/src/app/_services/auth.service.ts')
-rw-r--r-- | frontend/src/app/_services/auth.service.ts | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/frontend/src/app/_services/auth.service.ts b/frontend/src/app/_services/auth.service.ts index e474d436..92cebe7f 100644 --- a/frontend/src/app/_services/auth.service.ts +++ b/frontend/src/app/_services/auth.service.ts @@ -2,8 +2,8 @@ import { Injectable } from '@angular/core'; import { HttpClient, HttpHeaders } from '@angular/common/http'; import { JwtHelperService } from '@auth0/angular-jwt'; import { CookieService } from 'ngx-cookie-service'; -import API_SETTINGS from '../../config.json'; import shared from '../Shared'; +import { Configuration } from '../configuration.service'; const jwtHelper = new JwtHelperService(); @@ -17,15 +17,15 @@ export class AuthService { constructor(private http: HttpClient, private cookie: CookieService) { } login(username: string, password: string) { - return this.http.post(`${API_SETTINGS.apiURL}/auth/login`, { username, password }, { responseType: 'text' }); + return this.http.post(`${Configuration.settings.apiURL}/auth/login`, { username, password }, { responseType: 'text' }); } register(user: any) { - return this.http.post(`${API_SETTINGS.apiURL}/auth/register`, { ...user }, { responseType: 'text' }); + return this.http.post(`${Configuration.settings.apiURL}/auth/register`, { ...user }, { responseType: 'text' }); } getGuestToken() { - return this.http.post(`${API_SETTINGS.apiURL}/auth/guestToken`, {}, { responseType: 'text' }); + return this.http.post(`${Configuration.settings.apiURL}/auth/guestToken`, {}, { responseType: 'text' }); } isAuthenticated(): boolean { @@ -52,7 +52,7 @@ export class AuthService { var username = property['name']; if (username != "") { this.refresher = setTimeout(() => { - this.http.post(`${API_SETTINGS.apiURL}/auth/renewJwt`, {}, { headers: this.authHeader(), responseType: 'text' }).subscribe((response) => { + this.http.post(`${Configuration.settings.apiURL}/auth/renewJwt`, {}, { headers: this.authHeader(), responseType: 'text' }).subscribe((response) => { this.authenticate(response); }); }, exp.getTime() - new Date().getTime() - 60000); |