Total-numbers

This commit is contained in:
Kasper Rynning-Tønnesen
2020-01-21 10:08:34 +01:00
parent 3f422d9bf0
commit 467e6df2d3
4 changed files with 40 additions and 29 deletions

View File

@@ -2,9 +2,7 @@
<div v-if="highscore.length > 0">
<h3>Highscore</h3>
<ol>
<li v-for="person in highscore">
{{ person.name }} - {{ person.wins.length }}
</li>
<li v-for="person in highscore">{{ person.name }} - {{ person.wins.length }}</li>
</ol>
</div>
</template>
@@ -15,10 +13,11 @@ export default {
return { highscore: [] };
},
async mounted() {
let _response = await fetch(
"/api/highscore/statistics"
);
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;
});
this.highscore = response;
}
};