import { Injectable } from '@angular/core' ; import { HttpClient , HttpHeaders } from '@angular/common/http' ; import { Observable } from 'rxjs' ; const AUTH_API = 'http://localhost:8080/api/auth/' ; const httpOptions = { headers : new HttpHeaders ( { 'Content-Type' : 'application/json' } ) } ; @ Injectable ( { providedIn : 'root' } ) export class AuthService { constructor ( private http ) { } login ( username , password ) { return this . http . post ( AUTH_API + 'signin' , { username , password } , httpOptions ) ; } register ( username , email , password ) { return this . http . post ( AUTH_API + 'signup' , { username , email , password } , httpOptions ) ; } }