@@ -4,6 +4,7 @@ import { HttpClientModule, HttpClient, HttpHeaders } from '@angular/common/http'
44import 'rxjs/add/operator/map' ;
55import { User } from "../models/User" ;
66import { tokenNotExpired } from 'angular2-jwt' ;
7+ import { Values } from "../models/Values" ;
78
89@Injectable ( )
910
@@ -12,14 +13,15 @@ export class AuthService {
1213 authToken : any ;
1314 user : User ;
1415
15- constructor ( private http :HttpClient ) { }
16+ constructor ( private http :HttpClient ,
17+ private values : Values ) { }
1618
1719 authenticateUser ( user ) {
1820 let headers = new HttpHeaders ( ) ;
1921 //this.loadToken();
2022 //headers = headers.append('authorization', this.authToken);
2123 headers = headers . append ( 'Content-Type' , 'application/json' ) ;
22- return this . http . post < AuthenticateResultData > ( 'http://localhost:3000/ users/authenticate', user , { headers : headers } )
24+ return this . http . post < AuthenticateResultData > ( this . values . getServiceEndPoint ( ) + ' users/authenticate', user , { headers : headers } )
2325 . map (
2426 res => res ) ;
2527 }
@@ -49,7 +51,7 @@ export class AuthService {
4951 this . loadToken ( ) ;
5052 headers = headers . append ( 'Authorization' , this . authToken ) ;
5153 headers = headers . append ( 'Content-Type' , 'application/json' ) ;
52- return this . http . get < any > ( 'http://localhost:3000/ users/profile', { headers : headers } )
54+ return this . http . get < any > ( this . values . getServiceEndPoint ( ) + ' users/profile', { headers : headers } )
5355 . map ( res => res ) ;
5456 }
5557
0 commit comments