import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { RequestOptions } from '@angular/http';
import { Observable } from 'rxjs';

import { User } from '../core/entities';
import { environment } from 'src/environments/environment';

const LOGIN_URL = environment.apiUrl + '/api/account/login';

@Injectable()
export class LoginService {

	constructor(private http: HttpClient) {}

	login(user: User): Observable<User> {
		const options = { withCredentials: true };
		return this.http.post<User>('/api/account/login', user, options);
	}
}
