2020-05-31 20:25:39 +02:00
|
|
|
var app = new Vue({
|
2024-05-04 14:06:46 +02:00
|
|
|
el: "#app",
|
2020-05-31 20:25:39 +02:00
|
|
|
data: {
|
|
|
|
cfgs: [],
|
2024-05-04 14:06:46 +02:00
|
|
|
isLoading: true,
|
2020-05-31 20:25:39 +02:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
detailLink(id) {
|
2024-05-04 14:06:46 +02:00
|
|
|
return `${id}/`;
|
2020-05-31 20:25:39 +02:00
|
|
|
},
|
|
|
|
deleteLink(id) {
|
2024-05-04 14:06:46 +02:00
|
|
|
return `${id}/delete`;
|
2020-05-31 20:25:39 +02:00
|
|
|
},
|
|
|
|
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);
|
|
|
|
});
|
2020-05-31 20:25:39 +02:00
|
|
|
},
|
|
|
|
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();
|
2020-05-31 20:25:39 +02:00
|
|
|
},
|
2024-05-04 14:06:46 +02:00
|
|
|
});
|