puzzle/public/views/Replay.vue.js

27 lines
503 B
JavaScript
Raw Normal View History

2021-05-13 16:58:21 +02:00
"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
},
},
}