firstAttempt()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default class DemoMain { | |
constructor() { | |
this.goodReadsURL = `https://www.goodreads.com/shelf/list.xml`; | |
this.q = `key=${apiConfig.goodreadsKey}&user_id=${apiConfig.goodreadsUserID}&page=1`; | |
this.url = `${this.goodReadsURL}?${this.q}`; | |
} | |
logResult(url) { | |
axios.get(url, { params: { format: "json" } }) | |
.then((yqlResponse) => { | |
let data = yqlResponse.data; | |
// DefiantJS XPath query for user shelf for "read" section. | |
let search = JSON.search(data, "//*/user_shelf[name='read']"); | |
console.log(search); | |
}).catch((error) => { | |
alert(`error: ${error}`); | |
}); | |
} | |
firstAttempt() { | |
this.logResult(this.url); | |
} | |
} | |
var demo = new DemoMain(); | |
demo.firstAttempt(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment