| | |
| | | |
| | | @Injectable() |
| | | export class LoginService { |
| | | public authorization:Authorization; |
| | | public userContext:UserContext; |
| | | public authorization: Authorization; |
| | | public userContext: UserContext; |
| | | private urls = { |
| | | login:environment.SERVER_BASH_URL+'auth/login', |
| | | userContext:environment.SERVER_BASH_URL+'user-context', |
| | | login: environment.SERVER_BASH_URL + 'auth/login', |
| | | userContext: environment.SERVER_BASH_URL + 'user-context', |
| | | }; |
| | | constructor(private http:HttpClient) { } |
| | | public validate(username:string,password:string):Observable<Authorization>{ |
| | | return this.http.post(this.urls.login,{username:username,password:password,mode:"Web"}).map( |
| | | (res:any) => { |
| | | constructor(private http: HttpClient) { } |
| | | public validate(username: string, password: string): Observable<Authorization> { |
| | | return this.http.post(this.urls.login, {username: username, password: password, mode: 'Web'}).map( |
| | | (res: any) => { |
| | | this.authorization = res; |
| | | return res; |
| | | } |
| | | ); |
| | | } |
| | | public loadUserContext():void{ |
| | | public loadUserContext(): void { |
| | | this.http.get(this.urls.userContext).subscribe( |
| | | (res:UserContext) => { |
| | | (res: UserContext) => { |
| | | this.userContext = res; |
| | | return res; |
| | | } |