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 {
if (this.string !== this.show.description) {
event.preventDefault()
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, {
withCredentials: true,
headers: { 'Authorization': 'Bearer ' + this.$parent.$parent.user.access_token }
}).then(() => {
this.show.description = this.string
this.show.description = updatedShow.description
this.$refs.modalShowDescription.hide()
}).catch(error => {
this.$log.error(error.response.status + ' ' + error.response.statusText)
......@@ -590,12 +591,13 @@ export default {
if (this.string !== this.show.email) {
event.preventDefault()
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, {
withCredentials: true,
headers: { 'Authorization': 'Bearer ' + this.$parent.$parent.user.access_token }
}).then(() => {
this.show.email = this.string
this.show.email = updatedShow.email
this.$refs.modalShowEmail.hide()
}).catch(error => {
this.$log.error(error.response.status + ' ' + error.response.statusText)
......@@ -609,12 +611,13 @@ export default {
if (this.string !== this.show.website) {
event.preventDefault()
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, {
withCredentials: true,
headers: { 'Authorization': 'Bearer ' + this.$parent.$parent.user.access_token }
}).then(() => {
this.show.website = this.string
this.show.website = updatedShow.website
this.$refs.modalShowWebsite.hide()
}).catch(error => {
this.$log.error(error.response.status + ' ' + error.response.statusText)
......@@ -878,23 +881,28 @@ export default {
They are called from the parent component
*/
showName () {
this.string = this.show.name
if (this.show.name !== null) { this.string = this.show.name }
else { this.string = '' }
this.$refs.modalShowName.show()
},
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()
},
showDescription () {
this.string = this.show.description
if (this.show.description !== null) { this.string = this.show.description }
else { this.string = '' }
this.$refs.modalShowDescription.show()
},
showEmail () {
this.string = this.show.email
if (this.show.email !== null) { this.string = this.show.email }
else { this.string = '' }
this.$refs.modalShowEmail.show()
},
showWebsite () {
this.string = this.show.website
if (this.show.website !== null) { this.string = this.show.website }
else { this.string = '' }
this.$refs.modalShowWebsite.show()
},
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