1.0.5 • Published 9 years ago
http-local-auth v1.0.5
http-local-auth
Installation
npm install --save http-local-authUsage
import { HttpLocalAuthService } from 'http-local-auth';And inject the service to the constructor:
constructor (private HttpLocalAuth: HttpLocalAuthService) { ...And you can use all request type provided: GET, POST, PATCH, PUT and DELETE
HttpLocalAuth.get('/path-to-api-endpoint-or-file').subscribe((successCallback) => {
// do something
}, (errorCallback) => {
// do something
});Adding custom headers
HttpLocalAuth.addHeaders({<key>, <value>});Note
By default, 'Accept': 'application/json' and 'Content-Type': 'application/json' headers are already added. Also, the Authorization header is being appended every request with a value from localStorage item token.