Skip to content

Instantly share code, notes, and snippets.

@magyarn
Created April 18, 2019 14:22
Show Gist options
  • Save magyarn/7b64a2b4e47cd9fa9a2ae6f62bdf4125 to your computer and use it in GitHub Desktop.
Save magyarn/7b64a2b4e47cd9fa9a2ae6f62bdf4125 to your computer and use it in GitHub Desktop.
<template>
...
</template>
<script>
import flickr from '../flickr.js'
export default {
name: 'imageDetail',
props: {
id: String,
},
created() {
this.fetchImageInfo()
this.fetchImageSizes()
},
data() {
return {
imageInfo: null,
imageUrl: null,
}
},
computed: {
...
},
methods: {
...
fetchImageSizes() {
return flickr('photos.getSizes', { photo_id: this.id }).then(response => {
let sizes = response.data.sizes.size
this.imageUrl = sizes.filter(s => s.label === "Large")[0].source
})
}
}
}
</script>
<style>
...
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment