Merge branch 'master' of github.com:KevinMidboe/vinlottis

This commit is contained in:
2020-01-23 09:30:53 +01:00
13 changed files with 167 additions and 111 deletions

View File

@@ -12,11 +12,10 @@ export default {
async mounted() {
let canvas = this.$refs["purchase-chart"].getContext("2d");
let _response = undefined
if (process.env.NODE_ENV == 'development') {
let _response = undefined;
if (process.env.NODE_ENV == "development") {
_response = await fetch("http://localhost:30030/api/purchase/statistics");
}
else {
} else {
_response = await fetch("/api/purchase/statistics");
}
let response = await _response.json();
@@ -112,7 +111,15 @@ export default {
},
methods: {
getPrettierDateString(date) {
return `${date.getDate()}.${date.getMonth() + 1}.${date.getFullYear()}`;
return `${this.pad(date.getDate())}.${this.pad(
date.getMonth() + 1
)}.${this.pad(date.getYear() - 100)}`;
},
pad(num) {
if (num < 10) {
return `0${num}`;
}
return num;
}
}
};
@@ -121,14 +128,6 @@ export default {
<style lang="scss" scoped>
@import "../styles/media-queries.scss";
.chartjsLegend li span {
display: inline-block;
width: 12px;
height: 12px;
margin-right: 5px;
border-radius: 25px;
}
.chart {
height: 40vh;