38 lines
808 B
JavaScript
38 lines
808 B
JavaScript
|
var app = new Vue({
|
||
|
el: '#app',
|
||
|
data: {
|
||
|
cfgs: [],
|
||
|
isLoading: true
|
||
|
},
|
||
|
methods: {
|
||
|
detailLink(id) {
|
||
|
return `${id}/`
|
||
|
},
|
||
|
deleteLink(id) {
|
||
|
return `${id}/delete`
|
||
|
},
|
||
|
toggleActive(cfg) {
|
||
|
axios
|
||
|
.patch('/api/v2/config/pulls/' + cfg.id, { active: !cfg.active })
|
||
|
.then(response => {
|
||
|
i = this.cfgs.findIndex((obj => obj.id == cfg.id))
|
||
|
Vue.set(this.cfgs, i, response.data)
|
||
|
}
|
||
|
)
|
||
|
},
|
||
|
fetchData() {
|
||
|
axios
|
||
|
.get('/api/v2/config/pulls')
|
||
|
.then(response => {
|
||
|
this.cfgs = response.data
|
||
|
this.isLoading = false
|
||
|
})
|
||
|
}
|
||
|
},
|
||
|
mounted () {
|
||
|
axios.defaults.xsrfCookieName = 'csrftoken'
|
||
|
axios.defaults.xsrfHeaderName = 'X-CSRFTOKEN'
|
||
|
this.fetchData()
|
||
|
}
|
||
|
})
|