Created
October 29, 2019 09:25
-
-
Save iamburakcoskun/e9af10214d0e3476361c207b1911e48a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from "@angular/core"; | |
import { HttpClient } from "@angular/common/http"; | |
import { map } from "rxjs/operators"; | |
import { environment } from 'src/environments/environment.prod'; | |
@Injectable({ | |
providedIn: "root" | |
}) | |
export class AuthService { | |
constructor(private httpClient: HttpClient) { } | |
login(model: any) { | |
return this.httpClient.post(environment.baseUrl + "Authenticate", model).pipe( | |
map(function(response: any) { | |
const user = response; | |
if (user) { | |
localStorage.setItem("token", user.token); | |
} | |
}) | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment