JSFiddle - React, Tailwind, and code Playground
by Taburasoba
HTML
<script src="https://cdn.skypack.dev/@octokit/core"></script>
<div id="app">
<button type="button" @click="fetchIssues">
Fetch Closed Github issues
</button>
</div>
Vue
import { Octokit } from "https://cdn.skypack.dev/@octokit/core";
new Vue({
el: "#app",
data () {
return {
git_hub_username: "t-aburasoba",
repository_name: "StudyLaravel",
label_name: "enhancement"
}
},
methods: {
fetchIssues() {
const octokit = new Octokit()
const issueJson = octokit.request('GET /repos/{owner}/{repo}/issues',
{ owner: this.git_hub_username,
repo: this.repository_name,
state: 'closed',
sort: 'updated',
direction: 'desc',
labels: this.label_name,
per_page: 5 })
issueJson.then(response => {
response.data.forEach(issue => {
console.log(issue.title)
})
})
}
}
})