prepare use of vue for game/replay

This commit is contained in:
Zutatensuppe 2021-05-13 16:58:21 +02:00
parent 343263be6c
commit 8e7aa7d453
7 changed files with 156 additions and 43 deletions

View file

@ -0,0 +1,26 @@
"use strict"
export default {
name: 'replay',
template: `<div>{{replayData}}</div>`,
data() {
return {
replayData: null,
}
},
created() {
this.$watch(
() => this.$route.params,
() => { this.fetchData() },
{ immediate: true }
)
},
methods: {
async fetchData() {
this.replayData = null
const res = await fetch(`/api/replay-data/${this.$route.params.id}`)
const json = await res.json()
this.replayData = json
},
},
}