import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';

import { Observable } from 'rxjs';

import { environment } from '../../environments/environment';

import { User } from '../core/entities';

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

@Injectable()
export class LoginService {

  constructor(
    private http: HttpClient
  ) {}

  login(user: User): Observable<User> {
    return this.http.post<User>(LOGIN_URL, user);
  }
}
