Update/frontend logic #30 #33

Merged
KevinMidboe merged 19 commits from update/frontend_logic into master 2017-09-26 22:47:26 +00:00
Showing only changes of commit 00d000b8f8 - Show all commits

View File

@@ -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({