code cleanup

This commit is contained in:
2019-04-20 22:15:25 +02:00
parent f6ab07b346
commit 87d683d4af
6 changed files with 55 additions and 72 deletions

View File

@@ -1,6 +1,6 @@
<template>
<v-app>
<v-navigation-drawer app v-model="showNav">
<v-app dark>
<v-navigation-drawer app clipped mini-variant v-model="showNav">
<v-list>
<v-list-tile>
<v-list-tile-title>
@@ -24,7 +24,7 @@
</v-list>
</v-navigation-drawer>
<v-toolbar app>
<v-toolbar app clipped-left>
<v-toolbar-side-icon
@click.stop="showNav = !showNav"
></v-toolbar-side-icon>

View File

@@ -108,7 +108,8 @@ const mountEndPoint = function(url) {
delete (id) {
return _request.delete(url + id + '/')
},
options() { return _request.options(url) }
options() { return _request.options(url) },
list () { return _request.get( url ) }
}
}

View File

@@ -1,48 +1,48 @@
/* List view of recipes */
<template>
<v-list>
<template v-for="(item, idx) in items">
<v-list-tile
:key="item.title"
:to="`/recipes/id/${item.id}`">
<v-list-tile-content>
{{item.name}}
</v-list-tile-content>
</v-list-tile>
<v-divider v-if="idx < (items.length - 1)"
:key="idx"></v-divider>
</template>
</v-list>
</template>
<script>
export default {
data() {
return {
// Recipes from db grouped by categories id
content: {
0: [], 1: [], 2: [], 3: []
}
}
},
computed: {
items: function() {
return this.content[this.$route.params.cat];
}
},
created: function() {
const vm = this;
fetch('http://localhost:8000/api/recips/')
.then((response) => response.json())
.then(function(data) {
for (var idx in data) {
var obj = data[idx];
vm.content[parseInt(obj.category)].push(obj);
}
});
}
}
</script>
<style scoped>
</style>
/* List view of recipes */
<template>
<v-list>
<template v-for="(item, idx) in items">
<v-list-tile
:key="item.title"
:to="`/recipes/id/${item.id}`">
<v-list-tile-content>
{{item.name}}
</v-list-tile-content>
</v-list-tile>
<v-divider v-if="idx < (items.length - 1)"
:key="idx"></v-divider>
</template>
</v-list>
</template>
<script>
import api from '../../api.js'
export default {
data() {
return {
// Recipes from db grouped by categories id
content: {
0: [], 1: [], 2: [], 3: []
}
}
},
computed: {
items: function() {
return this.content[this.$route.params.cat];
}
},
created: function() {
api.recipes.list()
.then(data => {
for (var idx in data) {
var obj = data[idx];
this.content[parseInt(obj.category)].push(obj);
}
})
}
}
</script>
<style scoped>
</style>

View File

@@ -1,11 +1,6 @@
<template>
<section>
<v-img
:src="require('../assets/logo.svg')"
class="ma-3"
contain
height="200"
></v-img>
<h6 class="title">Home</h6>
</section>
</template>

View File

@@ -1,13 +0,0 @@
<template>
<HelloWorld />
</template>
<script>
import HelloWorld from '../components/HelloWorld'
export default {
components: {
HelloWorld
}
}
</script>

View File

@@ -1 +1 @@
{"status":"done","publicPath":"http://localhost:8080/","chunks":{"main":[{"name":"main.js","publicPath":"http://localhost:8080/main.js","path":"/home/artus/Documents/cookAssistant/frontend/dist/main.js"}]}}
{"status":"done","publicPath":"http://localhost:8080/","chunks":{"null":[{"name":"0.js","publicPath":"http://localhost:8080/0.js","path":"/home/artus/Documents/cookAssistant/frontend/dist/0.js"}],"app":[{"name":"app.js","publicPath":"http://localhost:8080/app.js","path":"/home/artus/Documents/cookAssistant/frontend/dist/app.js"},{"name":"app.bb93e89c95f5e29b766f.hot-update.js","publicPath":"http://localhost:8080/app.bb93e89c95f5e29b766f.hot-update.js","path":"/home/artus/Documents/cookAssistant/frontend/dist/app.bb93e89c95f5e29b766f.hot-update.js"}]}}