35 lines
683 B
JavaScript
35 lines
683 B
JavaScript
var app = new Vue({
|
|
el: '#app',
|
|
data: {
|
|
streams: [],
|
|
isLoading: true
|
|
},
|
|
methods: {
|
|
isPublishing(stream) {
|
|
return stream.publish_counter > 0
|
|
},
|
|
detailLink(id) {
|
|
return `${id}/`
|
|
},
|
|
deleteLink(id) {
|
|
return `${id}/delete`
|
|
},
|
|
fetchData() {
|
|
axios
|
|
.get('/api/v1/stream/')
|
|
.then(response => {
|
|
this.streams = response.data
|
|
this.isLoading = false
|
|
})
|
|
}
|
|
},
|
|
mounted () {
|
|
axios.defaults.xsrfCookieName = 'csrftoken'
|
|
axios.defaults.xsrfHeaderName = 'X-CSRFTOKEN'
|
|
this.fetchData()
|
|
setInterval(function () {
|
|
this.fetchData();
|
|
}.bind(this), 1000);
|
|
}
|
|
})
|