mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2024-12-23 01:20:24 +03:00
Updated ApiClient to return pagination data when listing short URLs
This commit is contained in:
parent
1f157a015b
commit
66a81d7e58
3 changed files with 10 additions and 9 deletions
|
@ -26,7 +26,7 @@ export class ShlinkApiClient {
|
|||
*/
|
||||
listShortUrls = (params = {}) => {
|
||||
return this._performRequest('/rest/short-codes', 'GET', params)
|
||||
.then(resp => resp.data.shortUrls.data)
|
||||
.then(resp => resp.data.shortUrls)
|
||||
.catch(e => this._handleAuthError(e, this.listShortUrls, [params]));
|
||||
};
|
||||
|
||||
|
|
|
@ -1,13 +1,19 @@
|
|||
import React from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import SearchBar from './SearchBar';
|
||||
import ShortUrlsList from './ShortUrlsList';
|
||||
import './ShortUrls.scss';
|
||||
import ShortUrlsList from './ShortUrlsList';
|
||||
|
||||
export default function ShortUrls(props) {
|
||||
export function ShortUrls(props) {
|
||||
return (
|
||||
<div className="short-urls-container">
|
||||
<div className="form-group"><SearchBar /></div>
|
||||
<ShortUrlsList {...props} />
|
||||
<ShortUrlsList {...props} shortUrlsList={props.shortUrlsList.data || []} />
|
||||
{/* Pagination */}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default connect(state => ({
|
||||
shortUrlsList: state.shortUrlsList
|
||||
}))(ShortUrls);
|
||||
|
|
|
@ -16,10 +16,6 @@ import './ShortUrlsList.scss';
|
|||
export class ShortUrlsList extends React.Component {
|
||||
componentDidMount() {
|
||||
const { match } = this.props;
|
||||
console.log(this.props.shortUrlsListParams, match.params, {
|
||||
...this.props.shortUrlsListParams,
|
||||
page: match.params.page
|
||||
});
|
||||
this.props.listShortUrls(match.params.serverId, {
|
||||
...this.props.shortUrlsListParams,
|
||||
page: match.params.page
|
||||
|
@ -134,7 +130,6 @@ class RowMenu extends React.Component {
|
|||
}
|
||||
|
||||
export default connect(state => ({
|
||||
shortUrlsList: state.shortUrlsList,
|
||||
selectedServer: state.selectedServer,
|
||||
shortUrlsListParams: state.shortUrlsListParams,
|
||||
}), { listShortUrls })(ShortUrlsList);
|
||||
|
|
Loading…
Reference in a new issue