flaschengeist-frontend/src/views/FinanzerView.vue

66 lines
2.0 KiB
Vue
Raw Normal View History

2019-12-21 07:20:25 +00:00
<template>
<div>
<TitleBar/>
<v-navigation-drawer permanent width="auto" app clipped class="elevation-2">
<v-container>
<h1 v-for="user in users" v-bind:key="user.id">{{user.firstname}} {{user.lastname}}</h1>
</v-container>
</v-navigation-drawer>
<v-content>
<v-container>
</v-container>
</v-content>
</div>
</template>
<script>
import TitleBar from "@/components/TitleBar";
2019-12-21 09:51:41 +00:00
import httpClient from "../plugins/restService";
2019-12-21 07:20:25 +00:00
export default {
name: "FinanzerView",
components: {TitleBar},
created() {
this.getUser()
},
data () {
return {
users: [],
}
},
methods: {
getUser() {
2019-12-21 09:51:41 +00:00
httpClient.getFinanzerMain(this.$store.getters.getToken)
2019-12-21 07:20:25 +00:00
.then(response => {
// eslint-disable-next-line no-console
2019-12-21 09:51:41 +00:00
console.log("ich bin hier. response: ", response.data)
2019-12-21 07:20:25 +00:00
for (let user in response.data) {
// eslint-disable-next-line no-console
2019-12-21 09:51:41 +00:00
console.log("user: ", user)
2019-12-21 07:20:25 +00:00
const lastId = this.users.length > 0 ? this.users[this.users.length - 1].id : 0
2019-12-21 09:51:41 +00:00
this.users.push({
id: lastId + 1,
username: response.data[user].username,
firstname: response.data[user].firstname,
lastname: response.data[user].lastname
})
}})
2019-12-21 07:20:25 +00:00
.catch(error => {
// eslint-disable-next-line no-console
console.log("error: ", error.response.data.error)
})
2019-12-21 09:51:41 +00:00
// eslint-disable-next-line no-console
console.log("this.users: ", this.users)
2019-12-21 07:20:25 +00:00
},
}
}
</script>
<style scoped>
</style>