| 1234567891011121314151617181920212223242526272829 |
- 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<JwtResponse> {
- return this.http.post<JwtResponse>(this.loginUrl, credentials, httpOptions);
- }
- signUp(info: SignupInfo): Observable<string> {
- return this.http.post<string>(this.signupUrl, info, httpOptions);
- }
- }
|