diff --git a/src/components/baruser/CreditLists.vue b/src/components/baruser/CreditLists.vue
index 795ee0a..3c5bf21 100644
--- a/src/components/baruser/CreditLists.vue
+++ b/src/components/baruser/CreditLists.vue
@@ -1,7 +1,7 @@
-
-
+
+
@@ -56,7 +56,7 @@
- {{(user.amount/100).toFixed(2)}} €
+ {{(user.amount/100).toFixed(2)}} €
@@ -70,6 +70,7 @@
diff --git a/src/plugins/restService.js b/src/plugins/restService.js
index 15a1e01..376f79b 100644
--- a/src/plugins/restService.js
+++ b/src/plugins/restService.js
@@ -15,7 +15,9 @@ class Service {
return axios.get(this.url+'bar', {headers: {Token: token}})
}
addAmountBar(token, data) {
- return axios.post(this.url+'baradd', ...data, {headers: {Token: token}})
+ // eslint-disable-next-line no-console
+ console.log("addAmountdata: ", data)
+ return axios.post(this.url+'baradd', {...data}, {headers: {Token: token}})
}
}
diff --git a/src/views/BarView.vue b/src/views/BarView.vue
index a9cf34c..cbdc99e 100644
--- a/src/views/BarView.vue
+++ b/src/views/BarView.vue
@@ -9,6 +9,7 @@
import TitleBar from "@/components/TitleBar";
import CreditLists from "@/components/baruser/CreditLists";
import httpClient from "../plugins/restService";
+ // eslint-disable-next-line no-unused-vars
import axios from "axios";
export default {
name: "BarView",
@@ -24,6 +25,7 @@
methods: {
getUser() {
// eslint-disable-next-line no-console
+ this. users = []
httpClient.getUserBar(this.$store.getters.getToken)
.then(response => {
// eslint-disable-next-line no-console
@@ -35,27 +37,33 @@
username: response.data[user].username,
firstname: response.data[user].firstname,
lastname: response.data[user].lastname,
- amount: response.data[user].amount
+ amount: response.data[user].amount,
+ type: response.data[user].type
})
}
})
.catch(error => {
// eslint-disable-next-line no-console
console.log(error)
+ this.$store.dispatch("logout")
this.users = []
})
},
+ // eslint-disable-next-line no-unused-vars
addAmount(username, amount) {
- axios.post('http://192.168.5.118:5000/baradd', {userId: username, amount: amount}, {headers: {Token: this.$store.getters.getToken}})
- //httpClient.addAmountBar(this.$store.getters.getToken, {username: username, amount: amount})
- /*.then(response => {
+ httpClient.addAmountBar(this.$store.getters.getToken, {userId: username, amount: amount})
+ .then((response) => {
+
// eslint-disable-next-line no-console
- console.log("responsedata: ", response.data)
+ console.log(response.data)
+
+ let user = this.users.find(user => {
+ // eslint-disable-next-line no-console
+ console.log(user)
+ return user.username === username ? user : false
+ })
+ user.amount = response.data.amount
})
- .catch(error => {
- // eslint-disable-next-line no-console
- console.log("error: ", error.response.data.error)
- })*/
}
}
}