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 = {}) => {
|
listShortUrls = (params = {}) => {
|
||||||
return this._performRequest('/rest/short-codes', 'GET', 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]));
|
.catch(e => this._handleAuthError(e, this.listShortUrls, [params]));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,19 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { connect } from 'react-redux';
|
||||||
import SearchBar from './SearchBar';
|
import SearchBar from './SearchBar';
|
||||||
import ShortUrlsList from './ShortUrlsList';
|
|
||||||
import './ShortUrls.scss';
|
import './ShortUrls.scss';
|
||||||
|
import ShortUrlsList from './ShortUrlsList';
|
||||||
|
|
||||||
export default function ShortUrls(props) {
|
export function ShortUrls(props) {
|
||||||
return (
|
return (
|
||||||
<div className="short-urls-container">
|
<div className="short-urls-container">
|
||||||
<div className="form-group"><SearchBar /></div>
|
<div className="form-group"><SearchBar /></div>
|
||||||
<ShortUrlsList {...props} />
|
<ShortUrlsList {...props} shortUrlsList={props.shortUrlsList.data || []} />
|
||||||
|
{/* Pagination */}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default connect(state => ({
|
||||||
|
shortUrlsList: state.shortUrlsList
|
||||||
|
}))(ShortUrls);
|
||||||
|
|
|
@ -16,10 +16,6 @@ import './ShortUrlsList.scss';
|
||||||
export class ShortUrlsList extends React.Component {
|
export class ShortUrlsList extends React.Component {
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
const { match } = this.props;
|
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.listShortUrls(match.params.serverId, {
|
||||||
...this.props.shortUrlsListParams,
|
...this.props.shortUrlsListParams,
|
||||||
page: match.params.page
|
page: match.params.page
|
||||||
|
@ -134,7 +130,6 @@ class RowMenu extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
export default connect(state => ({
|
export default connect(state => ({
|
||||||
shortUrlsList: state.shortUrlsList,
|
|
||||||
selectedServer: state.selectedServer,
|
selectedServer: state.selectedServer,
|
||||||
shortUrlsListParams: state.shortUrlsListParams,
|
shortUrlsListParams: state.shortUrlsListParams,
|
||||||
}), { listShortUrls })(ShortUrlsList);
|
}), { listShortUrls })(ShortUrlsList);
|
||||||
|
|
Loading…
Reference in a new issue