Started working in the infinate scroll so it loads the next page when visible on page. This commit was under_development bugs as of now.
This commit is contained in:
@@ -129,10 +129,24 @@ class SearchRequest extends React.Component {
|
||||
// mapped as a movieObject.
|
||||
response.json()
|
||||
.then(responseData => {
|
||||
this.setState({
|
||||
responseMovieList: responseData.results.map(searchResultItem => this.createMovieObjects(searchResultItem)),
|
||||
lastApiCallURI: uri // Save the value of the last sucessfull api call
|
||||
})
|
||||
if (this.state.page === 1) {
|
||||
this.setState({
|
||||
responseMovieList: responseData.results.map(searchResultItem => this.createMovieObjects(searchResultItem)),
|
||||
lastApiCallURI: uri // Save the value of the last sucessfull api call
|
||||
})
|
||||
} else {
|
||||
let responseMovieObjects = responseData.results.map(searchResultItem => this.createMovieObjects(searchResultItem));
|
||||
console.log(responseMovieObjects)
|
||||
console.log(this.state.responseMovieList)
|
||||
let growingReponseMovieObjectList = this.state.responseMovieList.concat(responseMovieObjects);
|
||||
this.setState({
|
||||
responseMovieList: growingReponseMovieObjectList,
|
||||
lastApiCallURI: uri // Save the value of the last sucessfull api call
|
||||
})
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error)
|
||||
})
|
||||
})
|
||||
.catch(() => {
|
||||
@@ -216,8 +230,6 @@ class SearchRequest extends React.Component {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Updates the internal state of the query search field.
|
||||
updateQueryState(event){
|
||||
this.setState({
|
||||
|
||||
Reference in New Issue
Block a user