ng2-wp-api
Advanced tools
Comparing version 1.2.7 to 1.2.8
{ | ||
"name": "ng2-wp-api", | ||
"version": "1.2.7", | ||
"version": "1.2.8", | ||
"description": "WordPress API Service for Angular2", | ||
@@ -5,0 +5,0 @@ "main": "./index.js", |
@@ -1,11 +0,5 @@ | ||
# Angular2 WordPress API Service Beta | ||
# Angular2 WordPress API Service [![npm](https://img.shields.io/npm/v/ng2-wp-api.svg?maxAge=2592000?style=plastic)](https://www.npmjs.com/package/ng2-wp-api) [![Build Status](https://travis-ci.org/MurhafSousli/ng2-wp-api.svg?branch=master)](https://travis-ci.org/MurhafSousli/ng2-wp-api) [![npm](https://img.shields.io/npm/dt/ng2-wp-api.svg?maxAge=2592000?style=plastic)](https://www.npmjs.com/package/ng2-wp-api) | ||
[![npm](https://img.shields.io/npm/v/ng2-wp-api.svg?maxAge=2592000?style=plastic)](https://www.npmjs.com/package/ng2-wp-api) [![Build Status](https://travis-ci.org/MurhafSousli/ng2-wp-api.svg?branch=master)](https://travis-ci.org/MurhafSousli/ng2-wp-api) | ||
[![npm](https://img.shields.io/npm/dt/ng2-wp-api.svg?maxAge=2592000?style=plastic)](https://www.npmjs.com/package/ng2-wp-api) | ||
![alt tag](/assets/cover.png?raw=true) | ||
![Alt text](/assets/logo.png?raw=true "Optional Title") | ||
# Purpose | ||
This library is designed to make it easy for your Angular2 application to request specific resources from a WordPress install. it returns the API server's response to your application as an `Observable<any>` object. | ||
@@ -17,3 +11,3 @@ | ||
# Installing | ||
# installation | ||
@@ -63,6 +57,3 @@ Install it with npm | ||
: | ||
**Default Endpoints** are : `Posts`, `Pages`, `Users`, `Categories`, `Tags`, `Taxonomies`, `Statuses`, `Comments`, `Media` | ||
@@ -392,2 +383,6 @@ | ||
# TODOs | ||
- Testing files | ||
<a name="issues"/> | ||
@@ -394,0 +389,0 @@ # Issues |
@@ -148,15 +148,8 @@ "use strict"; | ||
return this.http.get(this.state.generateUrl(this.endpoint, this.args), this.state.getOptions()).map((res) => { | ||
/** set totalObject and totalPages from response's headers | ||
* It's very weird that sometimes WP API total pages property name change | ||
* this is a workaround... | ||
*/ | ||
let totalPages = +res.headers.get('X-WP-TotalPages'); | ||
if (totalPages) { | ||
this.totalPages = +res.headers.get('X-WP-TotalPages'); | ||
this.totalObjects = +res.headers.get('X-WP-Total'); | ||
} | ||
else { | ||
this.totalPages = +res.headers.get('X-Wp-TotalPages'); | ||
this.totalObjects = +res.headers.get('X-Wp-Total'); | ||
} | ||
/** set totalObject and totalPages from response's headers */ | ||
this.totalPages = +res.headers.get('X-WP-TotalPages') || | ||
+res.headers.get('X-Wp-TotalPages') || | ||
+res.headers.get('X-Wp-Totalpages'); | ||
this.totalObjects = +res.headers.get('X-WP-Total') || | ||
+res.headers.get('X-Wp-Total'); | ||
return res.json(); | ||
@@ -163,0 +156,0 @@ }); |
@@ -162,15 +162,9 @@ import {Injectable} from '@angular/core'; | ||
(res) => { | ||
/** set totalObject and totalPages from response's headers | ||
* It's very weird that sometimes WP API total pages property name change | ||
* this is a workaround... | ||
*/ | ||
let totalPages = +res.headers.get('X-WP-TotalPages'); | ||
if(totalPages){ | ||
this.totalPages = +res.headers.get('X-WP-TotalPages'); | ||
this.totalObjects = +res.headers.get('X-WP-Total'); | ||
} | ||
else{ | ||
this.totalPages = +res.headers.get('X-Wp-TotalPages'); | ||
this.totalObjects = +res.headers.get('X-Wp-Total'); | ||
} | ||
/** set totalObject and totalPages from response's headers */ | ||
this.totalPages = +res.headers.get('X-WP-TotalPages') || | ||
+res.headers.get('X-Wp-TotalPages') || | ||
+res.headers.get('X-Wp-Totalpages'); | ||
this.totalObjects = +res.headers.get('X-WP-Total') || | ||
+res.headers.get('X-Wp-Total'); | ||
return res.json(); | ||
@@ -177,0 +171,0 @@ } |
Sorry, the diff of this file is not supported yet
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
493366
1912
404