Commit 3d27674c authored by jackie / Andrea Ida Malkah Klaura's avatar jackie / Andrea Ida Malkah Klaura
Browse files

FIX #22 implement activate & deactivate shows

parent 8457bee8
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
<b-button <b-button
variant="danger" variant="danger"
size="sm" size="sm"
@click="$refs.appModalSuperuser.showModalDeactivateShow(shows[currentShow].id, shows[currentShow].name)" @click="$refs.appModalSuperuser.showModalDeactivateShow(shows[currentShow])"
> >
Deactivate show Deactivate show
</b-button> </b-button>
...@@ -97,7 +97,7 @@ ...@@ -97,7 +97,7 @@
<b-button <b-button
variant="success" variant="success"
size="sm" size="sm"
@click="notYetImplemented()" @click="$refs.appModalSuperuser.activateShow(shows[currentShow])"
> >
Activate! Activate!
</b-button> </b-button>
......
...@@ -316,21 +316,41 @@ export default { ...@@ -316,21 +316,41 @@ export default {
deactivateShow (event) { deactivateShow (event) {
// prevent the modal from closing automatically on click // prevent the modal from closing automatically on click
event.preventDefault() event.preventDefault()
let uri = process.env.VUE_APP_API_STEERING_SHOWS + this.deactivatedShow.id let updatedShow = this.getUpdateShowObject()
axios.delete(uri, { updatedShow.is_active = false
let uri = process.env.VUE_APP_API_STEERING_SHOWS + this.deactivatedShow.id + '/'
axios.put(uri, updatedShow, {
withCredentials: true, withCredentials: true,
headers: { 'Authorization': 'Bearer ' + this.$parent.$parent.user.access_token } headers: { 'Authorization': 'Bearer ' + this.$parent.$parent.user.access_token }
}).then(() => { }).then(() => {
this.show.is_active = false
this.$refs.modalDeactivateShow.hide() this.$refs.modalDeactivateShow.hide()
this.$parent.loadAndSwitch(null)
}).catch(error => { }).catch(error => {
this.$log.error(error.response.status + ' ' + error.response.statusText) this.$log.error(error.response.status + ' ' + error.response.statusText)
this.$log.error(error.response) this.$log.error(error.response)
alert('Error: could not delete show. See console for details.') alert('Error: could not deactivate show. See console for details.')
// and we leave the modal open, so no call to its .hide function here // and we leave the modal open, so no call to its .hide function here
}) })
}, },
activateShow (show) {
this.show = show
let updatedShow = this.getUpdateShowObject()
updatedShow.is_active = true
let uri = process.env.VUE_APP_API_STEERING_SHOWS + show.id + '/'
axios.put(uri, updatedShow, {
withCredentials: true,
headers: { 'Authorization': 'Bearer ' + this.$parent.$parent.user.access_token }
}).then(() => {
this.show.is_active = true
this.$refs.modalDeactivateShow.hide()
}).catch(error => {
this.$log.error(error.response.status + ' ' + error.response.statusText)
this.$log.error(error.response)
alert('Error: could not activate show. See console for details.')
})
},
// remove an owner from the list of show owners // remove an owner from the list of show owners
deleteOwner (id) { deleteOwner (id) {
// we only have to find the item in our array and splice it out // we only have to find the item in our array and splice it out
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment