Skip to content

Instantly share code, notes, and snippets.

@sweemeng
Created January 18, 2018 03:31
Show Gist options
  • Save sweemeng/7c618ba1a5068a33d365dcc61973ee4c to your computer and use it in GitHub Desktop.
Save sweemeng/7c618ba1a5068a33d365dcc61973ee4c to your computer and use it in GitHub Desktop.
vue file for Sinar Project popit API POC 0.001
<template>
<ul v-if="results && results.length">
<li v-for="result of results" :key="result.id">
<p>{{ result.name }}</p>
</li>
</ul>
</template>
<script>
import axios from 'axios'
export default {
name: 'PopitList',
data () {
return {
results: [],
errors: []
}
},
created () {
console.log('loading')
axios.get('https://api.popit.sinarproject.org/en/persons/')
.then(response => {
this.results = response.data.results
})
.catch(e => {
this.errors.push(e)
})
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment