Added filtering by date to short URLs list

This commit is contained in:
Alejandro Celaya
2020-01-14 19:59:25 +01:00
parent 124441238b
commit b60908a5e9
12 changed files with 99 additions and 50 deletions

View File

@@ -1,5 +1,5 @@
import qs from 'qs';
import { isEmpty, isNil, reject } from 'ramda';
import { isEmpty, isNil, pipe, reject } from 'ramda';
import PropTypes from 'prop-types';
export const apiErrorType = PropTypes.shape({
@@ -21,9 +21,10 @@ export default class ShlinkApiClient {
this._apiKey = apiKey || '';
}
listShortUrls = (options = {}) =>
this._performRequest('/short-urls', 'GET', options)
.then((resp) => resp.data.shortUrls);
listShortUrls = pipe(
(options = {}) => reject(isNil, options),
(options = {}) => this._performRequest('/short-urls', 'GET', options).then((resp) => resp.data.shortUrls)
);
createShortUrl = (options) => {
const filteredOptions = reject((value) => isEmpty(value) || isNil(value), options);