-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added food view, just need to improve food lookup, then UI stuff
- Loading branch information
Joel Salisbury
committed
Feb 8, 2018
1 parent
45f1e61
commit 178c905
Showing
7 changed files
with
193 additions
and
22 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<template> | ||
<div class="food"> | ||
<h1>{{header}}</h1> | ||
<p>{{rank}}</p> | ||
<p>{{category}}</p> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
name: 'Food', | ||
data () { | ||
return { | ||
header:"Food Name", | ||
rank:"", | ||
category:"", | ||
foodInfo: {} | ||
} | ||
}, | ||
created () { | ||
this.getFoodInfo() | ||
}, | ||
methods:{ | ||
getFoodInfo: function() { | ||
this.$http.get('http://foodbank.develop.digitalmediauconn.org/api/food/barcode/038000311307').then((response) => { | ||
if(response.ok) { | ||
return response.body | ||
} | ||
}).then(function(results) { | ||
if(results.id === null) { | ||
this.$router.replace({name: '404'}) | ||
} else { | ||
this.header = results.data.name | ||
this.rank = results.data.rank.name | ||
this.category = results.data.category.name | ||
} | ||
}) | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
<style scoped> | ||
</style> |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,23 @@ | ||
import Vue from 'vue' | ||
import Router from 'vue-router' | ||
|
||
import SearchForm from '@/components/Search' | ||
import Food from '@/components/Food' | ||
var VueResource = require('vue-resource'); | ||
Vue.use(VueResource); | ||
|
||
Vue.use(Router) | ||
|
||
export default new Router({ | ||
routes: [ | ||
{ | ||
path: '/' | ||
} | ||
path: '/', | ||
name: 'SearchPage', | ||
component: SearchForm | ||
}, | ||
{ | ||
path: '/Food', | ||
name: 'Food', | ||
component: Food | ||
} | ||
] | ||
}) |