1
0
mirror of https://github.com/oceanprotocol/commons.git synced 2023-03-15 18:03:00 +01:00

search updates for Aquarius 0.2.2 & pagination fixes

This commit is contained in:
Matthias Kretschmann 2019-04-09 11:59:29 +02:00
parent 9a590b9788
commit fb64bcadbd
Signed by: m
GPG Key ID: 606EEEF3C479A91F
2 changed files with 5 additions and 6 deletions

View File

@ -47,7 +47,7 @@ export default class Pagination extends PureComponent<{
}> { }> {
public render() { public render() {
const { currentPage, totalPages, prevPage, setPage } = this.props const { currentPage, totalPages, prevPage, setPage } = this.props
const isFirst = currentPage === 0 const isFirst = currentPage === 1
const isLast = currentPage === totalPages const isLast = currentPage === totalPages
return totalPages > 1 ? ( return totalPages > 1 ? (

View File

@ -28,7 +28,7 @@ export default class Search extends PureComponent<SearchProps, SearchState> {
totalResults: 0, totalResults: 0,
offset: 25, offset: 25,
totalPages: 1, totalPages: 1,
currentPage: 0, currentPage: 1,
isLoading: true isLoading: true
} }
@ -59,15 +59,14 @@ export default class Search extends PureComponent<SearchProps, SearchState> {
results: search.results, results: search.results,
totalResults: search.totalResults, totalResults: search.totalResults,
totalPages: search.totalPages, totalPages: search.totalPages,
currentPage: search.page, // first page is always 0 in response
isLoading: false isLoading: false
}) })
Logger.log(`Loaded ${this.state.results.length} assets`) Logger.log(`Loaded ${this.state.results.length} assets`)
} }
private setPage = (page: number) => { private setPage = async (page: number) => {
this.setState({ currentPage: page }) await this.setState({ currentPage: page, isLoading: true })
this.searchAssets() await this.searchAssets()
} }
public renderResults = () => public renderResults = () =>