Skip to content
Permalink
76487d0845
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
33 lines (29 sloc) 875 Bytes
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http'
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/observable/throw';
import 'rxjs/add/operator/catch';
import { ReplaySubject } from 'rxjs';
@Injectable({
providedIn: 'root'
})
export class LoginService {
constructor(private http: HttpClient) { }
authorizeUser(loginInfo): Observable<Object> {
return this.http.post('http://sd5-backend.engr.uconn.edu/auth', loginInfo);
// .catch((err) => {
// const errObj = {
// message: 'Username or Password is Invalid',
// token: 'none'
// };
// return Observable.throw(errObj);
// })
}
getUser(token) {
return this.http.get('http://sd5-backend.engr.uconn.edu/user/me', {
headers: {
Authorization: 'Bearer ' + token
}
});
}
}