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