Skip to content

Commit

Permalink
master
Browse files Browse the repository at this point in the history
  • Loading branch information
zackha committed Sep 1, 2022
1 parent d650740 commit b3c790b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ This Data Provider fits REST APIs powered by [Woocommerce REST API](https://wooc

| Method | API calls |
| ------------------ | -----------------------------------------------------------------------------------------------------------------------------|
| `getList` | `GET https://example.com/orders?order=asc&page=1&per_page=10` |
| `getList` | `GET https://example.com/orders?order=asc&page=1&per_page=10&search=example&status=completed` |
| `getOne` | `GET https://example.com/orders/123` |
| `getMany` | `GET https://example.com/orders?include=123,456,789` |
| `getManyReference` | `GET https://example.com/orders/123/notes` |
Expand Down
2 changes: 1 addition & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
* @example
*
* getList => GET https://example.com/orders?order=asc&page=1&per_page=10
* getList => GET https://example.com/orders?order=asc&page=1&per_page=10&search=example&status=completed
* getOne => GET https://example.com/orders/123
* getMany => GET https://example.com/orders?include=123,456,789
* getManyReference => GET https://example.com/orders/123/notes
Expand Down
9 changes: 5 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { stringify } from 'query-string';
*
* @example
*
* getList => GET https://example.com/orders?order=asc&page=1&per_page=10
* getList => GET https://example.com/orders?order=asc&page=1&per_page=10&search=example&status=completed
* getOne => GET https://example.com/orders/123
* getMany => GET https://example.com/orders?include=123,456,789
* getManyReference => GET https://example.com/orders/123/notes
Expand Down Expand Up @@ -50,12 +50,13 @@ export default ({woocommerceUrl, consumerKey, consumerSecret,
getList: (resource, params) => {
const { page, perPage } = params.pagination;
const { field, order } = params.sort;
const { search, status } = params.filter;
const query = {
sort: JSON.stringify([field, order]),
filter: JSON.stringify(params.filter),
order: order.toLowerCase(),
page: page,
per_page: perPage,
order: (field, order === 'DESC' ? 'desc' : 'asc'),
search: search,
status: status,
};
const url = `${woocommerceUrl}/wp-json/wc/v3/${resource}?${stringify(query)}`;

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ra-data-woocommerce",
"version": "1.1.1",
"version": "1.1.2",
"description": "WooCommerce REST API data provider for react-admin",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit b3c790b

Please sign in to comment.