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

FIX #14 use vuejs logger instead of console.log

parent 308b4cd5
...@@ -88,18 +88,18 @@ export default { ...@@ -88,18 +88,18 @@ export default {
oidc.Log.logger = console oidc.Log.logger = console
let self = this let self = this
this.oidcmgr.events.addAccessTokenExpiring(function () { this.oidcmgr.events.addAccessTokenExpiring(function () {
console.log('starting silent access_token renewal') this.$log.debug('starting silent access_token renewal')
self.oidcmgr.signinSilent().then(function (user) { self.oidcmgr.signinSilent().then(function (user) {
self.user.access_token = user.access_token self.user.access_token = user.access_token
console.log(self.user.access_token) this.$log.debug(self.user.access_token)
}).catch(function (err) { }).catch(function (err) {
console.log(err) this.$log.debug(err)
alert('Your OpenID access token could not be renewed automatically.\n' + alert('Your OpenID access token could not be renewed automatically.\n' +
'You will be logged out in ' + process.env.VUE_APP_API_STEERING_OIDC_EXPIRE_NOTIFICATION + ' seconds.') 'You will be logged out in ' + process.env.VUE_APP_API_STEERING_OIDC_EXPIRE_NOTIFICATION + ' seconds.')
}) })
}) })
this.oidcmgr.events.addAccessTokenExpired(function () { this.oidcmgr.events.addAccessTokenExpired(function () {
console.log('expired!') this.$log.debug('expired!')
self.signOut() self.signOut()
}) })
this.getOIDCUser() this.getOIDCUser()
...@@ -107,16 +107,18 @@ export default { ...@@ -107,16 +107,18 @@ export default {
methods: { methods: {
signIn () { signIn () {
this.oidcmgr.signinRedirect().catch(function (err) { this.oidcmgr.signinRedirect().catch(function (err) {
console.log(err) alert('Error: something went wrong when signing in. See console for details.')
this.$log.error(err)
}) })
}, },
signOut () { signOut () {
let self = this let self = this
this.oidcmgr.signoutRedirect().then(function (resp) { this.oidcmgr.signoutRedirect().then(function (resp) {
self.user.logged_in = false self.user.logged_in = false
console.log('signed out', resp) this.$log.debug('signed out', resp)
}).catch(function (err) { }).catch(function (err) {
console.log(err) this.$log.error(err)
alert('Error: something went wrong when logging out. See console for details.')
}) })
}, },
getSteeringUser () { getSteeringUser () {
...@@ -139,7 +141,9 @@ export default { ...@@ -139,7 +141,9 @@ export default {
} }
} }
}).catch(error => { }).catch(error => {
alert('There was an error fetching user data from the steering backend: ' + error) this.$log.error(error.response.status + ' ' + error.response.statusText)
this.$log.error(error.response)
alert('Error: could not fetch user object from the steering backend. See console for details.')
}) })
}, },
getOIDCUser () { getOIDCUser () {
...@@ -157,7 +161,8 @@ export default { ...@@ -157,7 +161,8 @@ export default {
self.getSteeringUser() self.getSteeringUser()
} }
}).catch(function (err) { }).catch(function (err) {
console.log(err) this.$log.error(err)
alert('Error: could not fetch OIDC user object. See console for details.')
}) })
}, },
setUserProperties (user) { setUserProperties (user) {
...@@ -167,9 +172,9 @@ export default { ...@@ -167,9 +172,9 @@ export default {
this.user.email = user.profile.email this.user.email = user.profile.email
this.user.access_token = user.access_token this.user.access_token = user.access_token
// TODO: remove debug info after thorough testing // TODO: remove debug info after thorough testing
console.log(new Date(user.expires_at * 1000).toString()) this.$log.debug(new Date(user.expires_at * 1000).toString())
console.log(new Date(user.expires_at * 1000).toUTCString()) this.$log.debug(new Date(user.expires_at * 1000).toUTCString())
console.log(user.access_token) this.$log.debug(user.access_token)
} }
} }
} }
......
...@@ -29,16 +29,16 @@ ...@@ -29,16 +29,16 @@
import axios from 'axios' import axios from 'axios'
function debugErrorRequest (data, headers) { function debugErrorRequest (data, headers) {
console.log('Request headers:') this.$log.debug('Request headers:')
console.log(headers) this.$log.debug(headers)
console.log('Request data:') this.$log.debug('Request data:')
console.log(data) this.$log.debug(data)
return data return data
} }
function debugErrorResponse (data) { function debugErrorResponse (data) {
console.log('Response data:') this.$log.debug('Response data:')
console.log(data) this.$log.debug(data)
return data return data
} }
...@@ -56,10 +56,10 @@ export default { ...@@ -56,10 +56,10 @@ export default {
transformResponse: [debugErrorResponse] transformResponse: [debugErrorResponse]
}).then(response => { }).then(response => {
this.response = response this.response = response
console.log(response) this.$log.debug(response)
}).catch(error => { }).catch(error => {
console.log(error) this.$log.error(error)
alert(error) alert('Error: see console for details')
}) })
} }
} }
......
...@@ -1011,8 +1011,9 @@ export default { ...@@ -1011,8 +1011,9 @@ export default {
this.current.notes = [] this.current.notes = []
} }
}).catch(error => { }).catch(error => {
console.log(error) this.$log.error(error.response.status + ' ' + error.response.statusText)
alert('There was an error fetching timeslots from the server\n' + error) this.$log.error(error.response)
alert('Error: could not fetch timeslots. See console for details.')
}) })
// done fetching timeslots // done fetching timeslots
}, },
......
...@@ -78,15 +78,6 @@ import prettyDate from '../mixins/prettyDate' ...@@ -78,15 +78,6 @@ import prettyDate from '../mixins/prettyDate'
import slugify from '../mixins/slugify' import slugify from '../mixins/slugify'
import axios from 'axios' import axios from 'axios'
/*
function debugErrorResponse (data) {
console.log('Response data provided to transformResponse:')
console.log(data)
// alert(data)
return data
}
*/
export default { export default {
mixins: [ prettyDate, slugify ], mixins: [ prettyDate, slugify ],
props: { props: {
...@@ -156,9 +147,9 @@ export default { ...@@ -156,9 +147,9 @@ export default {
// everything was fine, we can close the modal now // everything was fine, we can close the modal now
this.$refs.modalNote.hide() this.$refs.modalNote.hide()
}).catch(error => { }).catch(error => {
console.log('Error:') this.$log.error(error.response.status + ' ' + error.response.statusText)
console.log(error) this.$log.error(error.response)
alert('There was an error while trying to update the note: ' + error) alert('Error: could not update the note. See console for details.')
// as there was an error saving the show, we have to make sure // as there was an error saving the show, we have to make sure
// to restore the initial values of the note object // to restore the initial values of the note object
this.note.title = this.backuptitle this.note.title = this.backuptitle
...@@ -221,9 +212,9 @@ export default { ...@@ -221,9 +212,9 @@ export default {
// everything was fine, we can close the modal now // everything was fine, we can close the modal now
this.$refs.modalNote.hide() this.$refs.modalNote.hide()
}).catch(error => { }).catch(error => {
console.log('Error:') this.$log.error(error.response.status + ' ' + error.response.statusText)
console.log(error) this.$log.error(error.response)
alert('There was an error while trying to posting the new note: ' + error) alert('Error: could not post the new note. See console for details.')
// as there was an error saving the show, we have to make sure // as there was an error saving the show, we have to make sure
// to restore the initial values of the note object // to restore the initial values of the note object
this.note.title = this.backuptitle this.note.title = this.backuptitle
...@@ -259,7 +250,6 @@ export default { ...@@ -259,7 +250,6 @@ export default {
this.content = this.note.content this.content = this.note.content
this.host_selected = this.note.host this.host_selected = this.note.host
} }
// console.log(this.$refs.modalNote)
this.timeslotID = timeslotID this.timeslotID = timeslotID
this.scheduleID = scheduleID this.scheduleID = scheduleID
this.$refs.modalNote.show() this.$refs.modalNote.show()
......
...@@ -398,13 +398,6 @@ ...@@ -398,13 +398,6 @@
<script> <script>
import axios from 'axios' import axios from 'axios'
// debug function - can be thrown out as soon as this component is stable
/* function debugErrorResponse (data) {
console.log('Response data provided to transformResponse:')
console.log(data)
return data
} */
export default { export default {
props: { props: {
show: { type: Object, required: true } show: { type: Object, required: true }
...@@ -531,9 +524,9 @@ export default { ...@@ -531,9 +524,9 @@ export default {
this.$refs.modalShowName.hide() this.$refs.modalShowName.hide()
}).catch(error => { }).catch(error => {
this.show.name = this.backupstring this.show.name = this.backupstring
console.log('Error:') this.$log.error(error.response.status + ' ' + error.response.statusText)
console.log(error) this.$log.error(error.response)
alert('Error: could not save the new show information') alert('Error: could not save the show name. See console for details.')
}) })
} }
}, },
...@@ -549,9 +542,9 @@ export default { ...@@ -549,9 +542,9 @@ export default {
this.$refs.modalShowShortDescription.hide() this.$refs.modalShowShortDescription.hide()
}).catch(error => { }).catch(error => {
this.show.short_description = this.backupstring this.show.short_description = this.backupstring
console.log('Error:') this.$log.error(error.response.status + ' ' + error.response.statusText)
console.log(error) this.$log.error(error.response)
alert('Error: could not save the new show information') alert('Error: could not save the show\'s short description. See console for details.')
}) })
} }
}, },
...@@ -567,9 +560,9 @@ export default { ...@@ -567,9 +560,9 @@ export default {
this.$refs.modalShowDescription.hide() this.$refs.modalShowDescription.hide()
}).catch(error => { }).catch(error => {
this.show.description = this.backupstring this.show.description = this.backupstring
console.log('Error:') this.$log.error(error.response.status + ' ' + error.response.statusText)
console.log(error) this.$log.error(error.response)
alert('Error: could not save the new show information') alert('Error: could not save the show description. See console for details.')
}) })
} }
}, },
...@@ -585,9 +578,9 @@ export default { ...@@ -585,9 +578,9 @@ export default {
this.$refs.modalShowEmail.hide() this.$refs.modalShowEmail.hide()
}).catch(error => { }).catch(error => {
this.show.email = this.backupstring this.show.email = this.backupstring
console.log('Error:') this.$log.error(error.response.status + ' ' + error.response.statusText)
console.log(error) this.$log.error(error.response)
alert('Error: could not save the new show information') alert('Error: could not save the show e-mail contact. See console for details.')
}) })
} }
}, },
...@@ -603,9 +596,9 @@ export default { ...@@ -603,9 +596,9 @@ export default {
this.$refs.modalShowWebsite.hide() this.$refs.modalShowWebsite.hide()
}).catch(error => { }).catch(error => {
this.show.website = this.backupstring this.show.website = this.backupstring
console.log('Error:') this.$log.error(error.response.status + ' ' + error.response.statusText)
console.log(error) this.$log.error(error.response)
alert('Error: could not save the new show information') alert('Error: could not save the show website. See console for details.')
}) })
} }
}, },
...@@ -621,9 +614,9 @@ export default { ...@@ -621,9 +614,9 @@ export default {
this.$refs.modalShowCBAid.hide() this.$refs.modalShowCBAid.hide()
}).catch(error => { }).catch(error => {
this.show.cba_series_id = this.backupid this.show.cba_series_id = this.backupid
console.log('Error:') this.$log.error(error.response.status + ' ' + error.response.statusText)
console.log(error) this.$log.error(error.response)
alert('Error: could not save the new show information') alert('Error: could not save the CBA show id. See console for details.')
}) })
} }
}, },
...@@ -640,9 +633,9 @@ export default { ...@@ -640,9 +633,9 @@ export default {
this.$refs.modalShowType.hide() this.$refs.modalShowType.hide()
}).catch(error => { }).catch(error => {
this.show.type = this.backupid this.show.type = this.backupid
console.log('Error:') this.$log.error(error.response.status + ' ' + error.response.statusText)
console.log(error) this.$log.error(error.response)
alert('Error: could not save the new show information') alert('Error: could not save the show type. See console for details.')
}) })
} }
}, },
...@@ -651,7 +644,6 @@ export default { ...@@ -651,7 +644,6 @@ export default {
event.preventDefault() event.preventDefault()
this.backupid = this.show.predecessor_id this.backupid = this.show.predecessor_id
this.show.predecessor_id = this.id this.show.predecessor_id = this.id
console.log(this.show.predecessor_id)
axios.put(process.env.VUE_APP_API_STEERING_SHOWS + this.show.id + '/', this.show, { axios.put(process.env.VUE_APP_API_STEERING_SHOWS + this.show.id + '/', this.show, {
withCredentials: true, withCredentials: true,
headers: { 'Authorization': 'Bearer ' + this.$parent.$parent.user.access_token } headers: { 'Authorization': 'Bearer ' + this.$parent.$parent.user.access_token }
...@@ -659,9 +651,9 @@ export default { ...@@ -659,9 +651,9 @@ export default {
this.$refs.modalShowPredecessor.hide() this.$refs.modalShowPredecessor.hide()
}).catch(error => { }).catch(error => {
this.show.predecessor = this.backupid this.show.predecessor = this.backupid
console.log('Error:') this.$log.error(error.response.status + ' ' + error.response.statusText)
console.log(error) this.$log.error(error.response)
alert('Error: could not save the new show information') alert('Error: could not save the show predecessor. See console for details.')
}) })
} }
}, },
...@@ -678,9 +670,9 @@ export default { ...@@ -678,9 +670,9 @@ export default {
this.$refs.modalShowType.hide() this.$refs.modalShowType.hide()
}).catch(error => { }).catch(error => {
this.show.fundingcategory = this.backupid this.show.fundingcategory = this.backupid
console.log('Error:') this.$log.error(error.response.status + ' ' + error.response.statusText)
console.log(error) this.$log.error(error.response)
alert('Error: could not save the new show information') alert('Error: could not save the show\' funding category. See console for details.')
}) })
} }
}, },
...@@ -729,9 +721,9 @@ export default { ...@@ -729,9 +721,9 @@ export default {
this.$refs.modalShowTopics.hide() this.$refs.modalShowTopics.hide()
}).catch(error => { }).catch(error => {
this.show.topic = this.backuparray this.show.topic = this.backuparray
console.log('Error:') this.$log.error(error.response.status + ' ' + error.response.statusText)
console.log(error) this.$log.error(error.response)
alert('Error: could not save the new show information') alert('Error: could not save the show\'s topics. See console for details.')
}) })
} }
}, },
...@@ -748,9 +740,9 @@ export default { ...@@ -748,9 +740,9 @@ export default {
this.$refs.modalShowMusicFocus.hide() this.$refs.modalShowMusicFocus.hide()
}).catch(error => { }).catch(error => {
this.show.musicfocus = this.backuparray this.show.musicfocus = this.backuparray
console.log('Error:') this.$log.error(error.response.status + ' ' + error.response.statusText)
console.log(error) this.$log.error(error.response)
alert('Error: could not save the new show information') alert('Error: could not save the show\'s music focus. See console for details.')
}) })
} }
}, },
...@@ -767,9 +759,9 @@ export default { ...@@ -767,9 +759,9 @@ export default {
this.$refs.modalShowLanguages.hide() this.$refs.modalShowLanguages.hide()
}).catch(error => { }).catch(error => {
this.show.language = this.backuparray this.show.language = this.backuparray
console.log('Error:') this.$log.error(error.response.status + ' ' + error.response.statusText)
console.log(error) this.$log.error(error.response)
alert('Error: could not save the new show information') alert('Error: could not save the show\'s languages. See console for details.')
}) })
} }
}, },
...@@ -786,9 +778,9 @@ export default { ...@@ -786,9 +778,9 @@ export default {
this.$refs.modalShowHosts.hide() this.$refs.modalShowHosts.hide()
}).catch(error => { }).catch(error => {
this.show.hosts = this.backuparray this.show.hosts = this.backuparray
console.log('Error:') this.$log.error(error.response.status + ' ' + error.response.statusText)
console.log(error) this.$log.error(error.response)
alert('Error: could not save the new show information') alert('Error: could not save the show\'s hosts. See console for details.')
}) })
} }
}, },
...@@ -906,9 +898,9 @@ export default { ...@@ -906,9 +898,9 @@ export default {
this.types = response.data this.types = response.data
this.loaded = true this.loaded = true
}).catch(error => { }).catch(error => {
console.log('Error:') this.$log.error(error.response.status + ' ' + error.response.statusText)
console.log(error) this.$log.error(error.response)
alert('Error: could not load available show types') alert('Error: could not load show types. See console for details.')
}) })
this.$refs.modalShowType.show() this.$refs.modalShowType.show()
}, },
...@@ -922,9 +914,9 @@ export default { ...@@ -922,9 +914,9 @@ export default {
this.fundingcategories = response.data this.fundingcategories = response.data
this.loaded = true this.loaded = true
}).catch(error => { }).catch(error => {
console.log('Error:') this.$log.error(error.response.status + ' ' + error.response.statusText)
console.log(error) this.$log.error(error.response)
alert('Error: could not load available funding categories') alert('Error: could not load funding categories. See console for details.')
}) })
this.$refs.modalShowFundingCategory.show() this.$refs.modalShowFundingCategory.show()
}, },
...@@ -938,9 +930,9 @@ export default { ...@@ -938,9 +930,9 @@ export default {
this.categories = response.data this.categories = response.data
this.loaded = true this.loaded = true
}).catch(error => { }).catch(error => {
console.log('Error:') this.$log.error(error.response.status + ' ' + error.response.statusText)
console.log(error) this.$log.error(error.response)
alert('Error: could not load available categories') alert('Error: could not load categories. See console for details.')
}) })
this.$refs.modalShowCategories.show() this.$refs.modalShowCategories.show()
}, },
...@@ -954,9 +946,9 @@ export default { ...@@ -954,9 +946,9 @@ export default {
this.topics = response.data this.topics = response.data
this.loaded = true this.loaded = true
}).catch(error => { }).catch(error => {
console.log('Error:') this.$log.error(error.response.status + ' ' + error.response.statusText)
console.log(error) this.$log.error(error.response)
alert('Error: could not load available topics') alert('Error: could not load topics. See console for details.')
}) })
this.$refs.modalShowTopics.show() this.$refs.modalShowTopics.show()
}, },
...@@ -970,9 +962,9 @@ export default { ...@@ -970,9 +962,9 @@ export default {
this.musicfocus = response.data this.musicfocus = response.data
this.loaded = true this.loaded = true
}).catch(error => { }).catch(error => {
console.log('Error:') this.$log.error(error.response.status + ' ' + error.response.statusText)
console.log(error)