Skip to content

Instantly share code, notes, and snippets.

@abhishekluv
Created February 10, 2020 12:07
Show Gist options
  • Save abhishekluv/8f6d1beaaa25206a6dbc86e7739f0c9d to your computer and use it in GitHub Desktop.
Save abhishekluv/8f6d1beaaa25206a6dbc86e7739f0c9d to your computer and use it in GitHub Desktop.
Angular Source Code Demo 1
import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';
@Injectable({
providedIn: 'root'
})
export class AccountService {
constructor(private http: HttpClient) { }
RegisterUser(user) {
let getHeaders: HttpHeaders = new HttpHeaders({ 'Content-Type': 'application/json' });
return this.http.post("https://localhost:44391/register", user, { headers: getHeaders });
}
LoginUser(user) {
let getHeaders: HttpHeaders = new HttpHeaders({ 'Content-Type': 'application/json' });
return this.http.post("https://localhost:44391/token", user, { headers: getHeaders });
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment