Skip to content

Commit

Permalink
feat: make application works when geolocation is disabled
Browse files Browse the repository at this point in the history
Closes #73
  • Loading branch information
claustres committed May 7, 2019
1 parent 6a013df commit a47b262
Showing 1 changed file with 26 additions and 9 deletions.
35 changes: 26 additions & 9 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

<script>
import _ from 'lodash'
import logger from 'loglevel'
import { Toast, Events, QAjaxBar } from 'quasar'
/*
Expand All @@ -18,17 +19,35 @@ export default {
QAjaxBar
},
methods: {
showError (message) {
Toast.create.negative({
showError (error) {
// Check if this error is a quiet one or not
if (error.ignore) {
// In this case simply log
logger.error(error)
return
}
const message = error.message || error.error_message
let options = {
html: message,
timeout: 5000
})
}
// Check if user can retry to avoid this error
if (error.retryHandler) {
options.button = {
label: this.$t('RETRY'),
handler: error.retryHandler
}
// Increase timeout so that user has a chance to retry
options.timeout = 2 * options.timeout
}
// Display error with relevant options
Toast.create.negative(options)
},
showRouteError (route) {
// We handle error on any page with query string
if (route.query) {
if (route.query.error_message) {
this.showError(route.query.error_message)
this.showError(route.query)
}
}
},
Expand Down Expand Up @@ -75,13 +94,11 @@ export default {
error.message += '<br/>' + this.$t('errors.' + key, translation.params)
})
}
} else {
} else if (error.code) {
// Overwrite the message using error code
if (error.code) {
error.message = this.$t('errors.' + error.code)
}
error.message = this.$t('errors.' + error.code)
}
this.showError(error.message)
this.showError(error)
})
Events.$on('before-hook', hook => {
this.nbRequests++
Expand Down

0 comments on commit a47b262

Please sign in to comment.