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() {
|
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 ? (
|
||||||
|
@ -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 = () =>
|
||||||
|
Loading…
Reference in New Issue
Block a user