Created
January 18, 2018 03:31
-
-
Save sweemeng/7c618ba1a5068a33d365dcc61973ee4c to your computer and use it in GitHub Desktop.
vue file for Sinar Project popit API POC 0.001
This file contains hidden or 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
<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