2021-05-13 16:58:21 +02:00
|
|
|
"use strict"
|
|
|
|
|
|
2021-05-13 17:20:10 +02:00
|
|
|
import main from './../game.js'
|
|
|
|
|
|
2021-05-13 16:58:21 +02:00
|
|
|
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
|
2021-05-13 17:20:10 +02:00
|
|
|
|
|
|
|
|
window.GAME_ID = this.gameData.GAME_ID
|
|
|
|
|
window.WS_ADDRESS = this.gameData.WS_ADDRESS
|
|
|
|
|
window.MODE = 'replay'
|
|
|
|
|
main(this.$el)
|
2021-05-13 16:58:21 +02:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}
|