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:
parent
9a590b9788
commit
fb64bcadbd
@ -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 ? (
|
||||
|
@ -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 = () =>
|
||||
|
Loading…
Reference in New Issue
Block a user