Files
vinlottis/src/ui/Highscore.vue
Kasper Rynning-Tønnesen 7ca3686725 Margins
2020-01-22 13:21:13 +01:00

39 lines
789 B
Vue

<template>
<div v-if="highscore.length > 0">
<h3>Highscore</h3>
<ol>
<li v-for="person in highscore">
{{ person.name }} - {{ person.wins.length }}
</li>
</ol>
</div>
</template>
<script>
export default {
data() {
return { highscore: [] };
},
async mounted() {
let _response = await fetch("/api/highscore/statistics");
let response = await _response.json();
response.sort((a, b) => {
return a.wins.length > b.wins.length ? -1 : 1;
});
response = response.filter(
person => person.name != null && person.name != ""
);
this.highscore = response;
}
};
</script>
<style lang="scss" scoped>
div {
margin: 15px 0 0 0;
font-family: "knowit";
display: inline-flex;
flex-direction: column;
}
</style>