Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
individual food view works.
  • Loading branch information
Joel Salisbury committed Jun 25, 2018
1 parent 73a9533 commit f1d39f9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/components/Food.vue
@@ -1,6 +1,7 @@
<template>
<div class="food">
<h1>{{header}}</h1>
<h2>{{barcode}}</h2>
<p>{{rank}}</p>
<p>{{category}}</p>
</div>
Expand All @@ -10,6 +11,7 @@
import axios from 'axios';
export default {
name: 'Food',
props: ['barcode'],
data () {
return {
header:"Food Name",
Expand All @@ -26,9 +28,11 @@ export default {
methods:{
getFoodInfo: function() {
axios.get('http://foodbank.develop.digitalmediauconn.org/api/food/barcode/038000311307').then((response) => {
axios.get('http://foodbank.develop.digitalmediauconn.org/api/food/barcode/'+ this.barcode).then((response) => {
this.loading = false;
this.header = response.data.data.name;
this.category = response.data.data.category.name;
this.rank = response.data.data.rank.name;
}, (error) => {
this.loading = false;
})
Expand Down
3 changes: 2 additions & 1 deletion src/router/index.js
Expand Up @@ -15,8 +15,9 @@ export default new Router({
component: SearchForm
},
{
path: '/Food',
path: '/Food/:barcode',
name: 'Food',
props:true,
component: Food
}
]
Expand Down

0 comments on commit f1d39f9

Please sign in to comment.