NGXCookieAPI
This library was generated with Angular CLI version 7.2.0.
Main features of NGXCookieAPI!
- Easy Api Call
- Cookie options
- Transferstate ( it will avoid page flicker and avoid api call twice when using SSR)
This library created for reduce coding. In this library included cookie, POST, GET, PUT, PATCH, DELETE.
We have used transferstate for GET Method, so you can use these data without call api again and again This libray created and tested with latest version of angular version 7.2.0.
Installation
Install the dependencies and devDependencies and start the server.
$ npm i ngx-cookie-api-service
Import ngx-cookie-api in your app.module.ts file
;;;;;;; @
Installation
In your component file import "NGXCookieAPIService"
; {}
API Calls
for GET method
let con = thisapiService; con;
- 'https://reqres.in/api' - api base path
- 'users' - api sub path
- {"page":"3"} - parameter, it should be object format for GET method
- {"X-CustomHttpHeader": "CUSTOM_VALUE"} - additional header, it should be object format
- 5th parameter ( true ) is enable or disable transfersate - default value is true
- 6th paramete ( false ) is keep transferstate value until page reload or not, if set true mean transferstate value won't removed untill page reload - defalult is false
for POST method
this apiService ;
for PUT method
this apiService ;
for PATCH method
this apiService ;
for DELETE method
this apiService ;
Cookie
Set cookie
thisapiService;
Get cookie
thisapiService;
Check cookie exist or not
thisapiService;
Delete cookie
thisapiService;
Delete All cookie
thisapiService;
Free Software, Hell Yeah!