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

Merge pull request #88 from oceanprotocol/fix/search

search updates for Aquarius 0.2.2
This commit is contained in:
Matthias Kretschmann 2019-04-09 12:08:54 +02:00 committed by GitHub
commit f9717b84f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 6 deletions

View File

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

View File

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