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 @@
<b-button
variant="danger"
size="sm"
@click="$refs.appModalSuperuser.showModalDeactivateShow(shows[currentShow].id, shows[currentShow].name)"
@click="$refs.appModalSuperuser.showModalDeactivateShow(shows[currentShow])"
>
Deactivate show
</b-button>
......@@ -97,7 +97,7 @@
<b-button
variant="success"
size="sm"
@click="notYetImplemented()"
@click="$refs.appModalSuperuser.activateShow(shows[currentShow])"
>
Activate!
</b-button>
......
......@@ -316,21 +316,41 @@ export default {
deactivateShow (event) {
// prevent the modal from closing automatically on click
event.preventDefault()
let uri = process.env.VUE_APP_API_STEERING_SHOWS + this.deactivatedShow.id
axios.delete(uri, {
let updatedShow = this.getUpdateShowObject()
updatedShow.is_active = false
let uri = process.env.VUE_APP_API_STEERING_SHOWS + this.deactivatedShow.id + '/'
axios.put(uri, updatedShow, {
withCredentials: true,
headers: { 'Authorization': 'Bearer ' + this.$parent.$parent.user.access_token }
}).then(() => {
this.show.is_active = false
this.$refs.modalDeactivateShow.hide()
this.$parent.loadAndSwitch(null)
}).catch(error => {
this.$log.error(error.response.status + ' ' + error.response.statusText)
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
})
},
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
deleteOwner (id) {
// 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