Permalink
Browse files

More advanced github commits

  • Loading branch information...
Adamkillander96 committed Aug 2, 2018
1 parent b420434 commit ed19f2883f61cc50a52b462091fd4aead39d6b4b
@@ -2,7 +2,25 @@
<b-row>
<b-col cols="12">
<h3 class="text-success">{{ $t('updateTitle') }}</h3>
<p>Adam Killander/AdamsPortfolio@ Master</p>
<template v-for="repositorie in repositories">
<input type="radio"
:key="repositorie.key"
:id="repositorie"
:value="repositorie"
name="repositorie"
v-model="currentRepositorie">
<label :for="repositorie" :key="repositorie.key">{{ repositorie }}</label>
</template>
<template v-for="branch in branches">
<input type="radio"
:key="branch.key"
:id="branch"
:value="branch"
name="branch"
v-model="currentBranch">
<label :for="branch" :key="branch.key">{{ branch }}</label>
</template>
<p>Adam Killander/AdamsPortfolio@ {{ currentBranch }}</p>
<hr class="border-success">
</b-col>
<b-col md="4" class="p-0 mb-4" v-for="record in commits" v-bind:key="record.id">
@@ -24,20 +42,24 @@

<script>
var apiURL = 'https://api.github.com/repos/Adamkillander96/AdamsPortfolio/commits?per_page=3&sha='
export default {
name: 'update-component',
data() {
return {
branches: ['master'],
repositories: ['AdamsPortfolio', 'instant-app-maker'],
currentRepositorie: 'AdamsPortfolio',
branches: ['master', 'docs'],
currentBranch: 'master',
commits: null
}
},
created: function () {
this.fetchData()
},
watch: {
currentRepositorie: 'fetchData',
currentBranch: 'fetchData'
},
filters: {
truncate: function (v) {
var newline = v.indexOf('\n')
@@ -51,7 +73,7 @@ export default {
fetchData: function () {
var xhr = new XMLHttpRequest()
var self = this
xhr.open('GET', apiURL + self.currentBranch)
xhr.open('GET', 'https://api.github.com/repos/Adamkillander96/' + self.currentRepositorie + '/commits?per_page=3&sha=' + self.currentBranch)
xhr.onload = function () {
self.commits = JSON.parse(xhr.responseText)
console.log(self.commits[0].html_url)
@@ -22,9 +22,6 @@
</template>

<script>
import axios from 'axios'
import VueAxios from 'vue-axios'
export default {
name: 'website-template',
data() {

0 comments on commit ed19f28

Please sign in to comment.