portier/source/static/js/stream-list.js

36 lines
702 B
JavaScript
Raw Permalink Normal View History

var app = new Vue({
2024-05-04 14:06:46 +02:00
el: "#app",
data: {
streams: [],
2024-05-04 14:06:46 +02:00
isLoading: true,
},
methods: {
isPublishing(stream) {
2024-05-04 14:06:46 +02:00
return stream.publish_counter > 0;
},
detailLink(id) {
2024-05-04 14:06:46 +02:00
return `${id}/`;
},
deleteLink(id) {
2024-05-04 14:06:46 +02:00
return `${id}/delete`;
},
fetchData() {
2024-05-04 14:06:46 +02:00
axios.get("/api/v2/config/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,
);
},
2024-05-04 14:06:46 +02:00
});