import { Injectable } from '@angular/core'; import {HttpClient, HttpHeaders} from '@angular/common/http'; import {LoginInfo} from './login-info'; import {Observable} from 'rxjs'; import {JwtResponse} from './jwt-response'; import {SignupInfo} from './signup-info'; const httpOptions = { headers: new HttpHeaders({'Content-Type': 'application/json'}) }; @Injectable({ providedIn: 'root' }) export class AuthService { private loginUrl = 'http://localhost:8085/auth/signin'; private signupUrl = 'http://localhost:8085/auth/signup'; constructor(private http: HttpClient) { } attemptAuth(credentials: LoginInfo): Observable { return this.http.post(this.loginUrl, credentials, httpOptions); } signUp(info: SignupInfo): Observable { return this.http.post(this.signupUrl, info, httpOptions); } }