diff options
author | Mark Powers <markppowers0@gmail.com> | 2020-04-12 14:42:03 -0500 |
---|---|---|
committer | Mark Powers <markppowers0@gmail.com> | 2020-04-12 14:42:03 -0500 |
commit | 7e6648902b262484bc0aac824c3784b1ae4b8591 (patch) | |
tree | bc56275222a58228fd714af0dad58c660f004ab7 /src/scores.html | |
parent | 1bffb064e2414ced5b1924a4f9fbd822a09c718e (diff) |
Update games, add scores
Diffstat (limited to 'src/scores.html')
-rw-r--r-- | src/scores.html | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/scores.html b/src/scores.html new file mode 100644 index 0000000..f3b1050 --- /dev/null +++ b/src/scores.html @@ -0,0 +1,51 @@ +<!doctype html> +<html lang="en"> + +<head> + <title>High Scores</title> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> + <!-- <link rel="stylesheet" type="text/css" href="/css/styles.css"> --> + <!-- <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script> --> + <script src="https://cdn.jsdelivr.net/npm/vue"></script> +</head> + +<body> + <script> + window.onload = function () { + var transactionData = new Vue({ + el: '#main', + data: { + scores: [], + }, + created() { + fetch(new Request(`/scores`)).then(response => response.json()) + .then(response => this.scores = response); + + }, + }); + } + </script> + <div id="main"> + <h1>High Scores</h1> + <div v-for="game in Object.keys(scores)"> + <h2>{{game}}</h2> + <table class="table"> + <tr> + <th>Rank</th> + <th>Score</th> + <th>Username</th> + <th>Date</th> + </tr> + <tr v-for="(item, i) in scores[game]"> + <td>{{i+1}}</td> + <td>{{item.score}}</td> + <td>{{item.username}}</td> + <td>{{item.createdAt.substring(0, 16).replace("T", " ")}}</td> + </tr> + </table> + </div> + </div> +</body> + +</html>
\ No newline at end of file |