Skip to content

Commit

Permalink
Fix: Convert objects into methods
Browse files Browse the repository at this point in the history
  • Loading branch information
dhivyada committed Apr 4, 2020
1 parent c2db131 commit acbae3c
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/components/Autocomplete.vue
Original file line number Diff line number Diff line change
Expand Up @@ -290,30 +290,26 @@ export default {
return this.handleFetchRequest(promise)
},
handleFetchResponse: (response) => {
handleFetchResponse (response) {
if (response.ok) {
this.error = null
return response.json()
}
throw new Error(NETWORK_RESPONSE_ERROR)
},
handlePromiseResolution: (response) => {
handlePromiseResolution (response) {
if (response.status === 200) {
this.error = null
return response
}
throw new Error(NETWORK_RESPONSE_ERROR)
},
handleFetchRequest (promise) {
handleFetchRequest: function (promise) {
return this.handlePromise(promise, (response) => this.handleFetchResponse(response))
},
handleCallback (promise) {
return this.handlePromise(promise, (response) => this.handlePromiseResolution(response))
},
handlePromise (promise, responseHandler) {
return promise
.then(response => {
Expand Down

0 comments on commit acbae3c

Please sign in to comment.