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

35 lines
793 B
JavaScript
Raw Normal View History

var app = new Vue({
2024-05-04 14:06:46 +02:00
el: "#app",
data: {
cfgs: [],
2024-05-04 14:06:46 +02:00
isLoading: true,
},
methods: {
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`;
},
toggleActive(cfg) {
axios
2024-05-04 14:06:46 +02:00
.patch("/api/v2/config/restream/" + cfg.id, { active: !cfg.active })
.then((response) => {
i = this.cfgs.findIndex((obj) => obj.id == cfg.id);
Vue.set(this.cfgs, i, response.data);
});
},
fetchData() {
2024-05-04 14:06:46 +02:00
axios.get("/api/v2/config/restream").then((response) => {
this.cfgs = response.data;
this.isLoading = false;
});
},
},
mounted() {
axios.defaults.xsrfCookieName = "csrftoken";
axios.defaults.xsrfHeaderName = "X-CSRFTOKEN";
this.fetchData();
},
2024-05-04 14:06:46 +02:00
});