@wordpress/api-request
Advanced tools
Comparing version 1.0.0-alpha.3 to 1.0.0
{ | ||
"name": "@wordpress/api-request", | ||
"version": "1.0.0-alpha.3", | ||
"version": "1.0.0", | ||
"description": "Utility to call WordPress REST APIs", | ||
@@ -12,3 +12,3 @@ "author": "The WordPress Contributors", | ||
], | ||
"homepage": "https://github.com/WordPress/gutenberg/tree/master/packages/api-request/README.md", | ||
"homepage": "https://github.com/WordPress/gutenberg/tree/master/packages/api-fetch/README.md", | ||
"repository": { | ||
@@ -21,11 +21,5 @@ "type": "git", | ||
}, | ||
"main": "build/index.js", | ||
"module": "build-module/index.js", | ||
"dependencies": { | ||
"jquery": "^3.3.1" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"gitHead": "8827c049ec802471f51a5cb906d9096ffc1b4e48" | ||
} | ||
} |
@@ -1,42 +0,5 @@ | ||
# @wordpress/api-request | ||
This package has been deprecated in favor of `@wordpress/api-fetch`, please install the new package. | ||
Wrapper around `jQuery.ajax` to call WordPress REST APIs. | ||
## Installation | ||
Install the module | ||
```bash | ||
npm install @wordpress/api-request --save | ||
npm install @wordpress/api-fetch | ||
``` | ||
## Usage | ||
```js | ||
import apiRequest from '@wordpress/api-request'; | ||
apiRequest( { path: '/wp/v2/posts' } ).then( posts => { | ||
console.log( posts ); | ||
} ); | ||
``` | ||
### Middlewares | ||
the `api-request` package supports middlewares. Middlewares are functions you can use to wrap the `wp.apiRequest` calls to perform any pre/post process to the API requests. | ||
**Example** | ||
```js | ||
wp.apiRequest.use( ( options, next ) => { | ||
const start = Date.now(); | ||
const result = next( options ); | ||
result.then( () => { | ||
console.log( 'The request took ' + Date.now() - start ); | ||
} ); | ||
return result; | ||
} ); | ||
``` | ||
The apiRequest package provides built-in middlewares you can use to provide a `nonce` and a custom `rootURL`. | ||
<br/><br/><p align="center"><img src="https://s.w.org/style/images/codeispoetry.png?1" alt="Code is Poetry." /></p> |
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
Empty package
Supply chain riskPackage does not contain any code. It may be removed, is name squatting, or the result of a faulty package publish.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
0
0
697
2
0
1
6
2
- Removedjquery@^3.3.1
- Removedjquery@3.7.1(transitive)