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

ShowManager: handle empty strings as null

parent 8a45f85d
...@@ -571,12 +571,13 @@ export default { ...@@ -571,12 +571,13 @@ export default {
if (this.string !== this.show.description) { if (this.string !== this.show.description) {
event.preventDefault() event.preventDefault()
let updatedShow = this.getUpdateShowObject() let updatedShow = this.getUpdateShowObject()
updatedShow.description = this.string if (this.string === '') { updatedShow.description = null }
else { updatedShow.description = this.string }
axios.put(process.env.VUE_APP_API_STEERING_SHOWS + this.show.id + '/', updatedShow, { axios.put(process.env.VUE_APP_API_STEERING_SHOWS + this.show.id + '/', 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.description = this.string this.show.description = updatedShow.description
this.$refs.modalShowDescription.hide() this.$refs.modalShowDescription.hide()
}).catch(error => { }).catch(error => {
this.$log.error(error.response.status + ' ' + error.response.statusText) this.$log.error(error.response.status + ' ' + error.response.statusText)
...@@ -590,12 +591,13 @@ export default { ...@@ -590,12 +591,13 @@ export default {
if (this.string !== this.show.email) { if (this.string !== this.show.email) {
event.preventDefault() event.preventDefault()
let updatedShow = this.getUpdateShowObject() let updatedShow = this.getUpdateShowObject()
updatedShow.email = this.string if (this.string === '') { updatedShow.email = null }
else { updatedShow.email = this.string }
axios.put(process.env.VUE_APP_API_STEERING_SHOWS + this.show.id + '/', updatedShow, { axios.put(process.env.VUE_APP_API_STEERING_SHOWS + this.show.id + '/', 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.email = this.string this.show.email = updatedShow.email
this.$refs.modalShowEmail.hide() this.$refs.modalShowEmail.hide()
}).catch(error => { }).catch(error => {
this.$log.error(error.response.status + ' ' + error.response.statusText) this.$log.error(error.response.status + ' ' + error.response.statusText)
...@@ -609,12 +611,13 @@ export default { ...@@ -609,12 +611,13 @@ export default {
if (this.string !== this.show.website) { if (this.string !== this.show.website) {
event.preventDefault() event.preventDefault()
let updatedShow = this.getUpdateShowObject() let updatedShow = this.getUpdateShowObject()
updatedShow.website = this.string if (this.string === '') { updatedShow.website = null }
else { updatedShow.website = this.string }
axios.put(process.env.VUE_APP_API_STEERING_SHOWS + this.show.id + '/', updatedShow, { axios.put(process.env.VUE_APP_API_STEERING_SHOWS + this.show.id + '/', 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.website = this.string this.show.website = updatedShow.website
this.$refs.modalShowWebsite.hide() this.$refs.modalShowWebsite.hide()
}).catch(error => { }).catch(error => {
this.$log.error(error.response.status + ' ' + error.response.statusText) this.$log.error(error.response.status + ' ' + error.response.statusText)
...@@ -878,23 +881,28 @@ export default { ...@@ -878,23 +881,28 @@ export default {
They are called from the parent component They are called from the parent component
*/ */
showName () { showName () {
this.string = this.show.name if (this.show.name !== null) { this.string = this.show.name }
else { this.string = '' }
this.$refs.modalShowName.show() this.$refs.modalShowName.show()
}, },
showShortDescription () { showShortDescription () {
this.string = this.show.short_description if (this.show.short_description !== null) { this.string = this.show.short_description }
else { this.string = '' }
this.$refs.modalShowShortDescription.show() this.$refs.modalShowShortDescription.show()
}, },
showDescription () { showDescription () {
this.string = this.show.description if (this.show.description !== null) { this.string = this.show.description }
else { this.string = '' }
this.$refs.modalShowDescription.show() this.$refs.modalShowDescription.show()
}, },
showEmail () { showEmail () {
this.string = this.show.email if (this.show.email !== null) { this.string = this.show.email }
else { this.string = '' }
this.$refs.modalShowEmail.show() this.$refs.modalShowEmail.show()
}, },
showWebsite () { showWebsite () {
this.string = this.show.website if (this.show.website !== null) { this.string = this.show.website }
else { this.string = '' }
this.$refs.modalShowWebsite.show() this.$refs.modalShowWebsite.show()
}, },
showCBAid () { showCBAid () {
......
Supports Markdown
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