2020-01-10 00:07:37 +01:00
|
|
|
<template>
|
2020-01-14 11:48:42 +01:00
|
|
|
<div class="error-message">
|
2022-05-19 15:50:06 +02:00
|
|
|
<modal v-model="ShowModal" :closable="this.showcloseButton">
|
2020-01-14 11:48:42 +01:00
|
|
|
<div class="error-message" v-if="$route.name == '404'">
|
2020-01-10 10:25:29 +01:00
|
|
|
<p class="error-404"></p>
|
2020-01-14 11:48:42 +01:00
|
|
|
<p>{{ $t('errors.resource_not_found') }}</p>
|
2020-10-14 23:33:07 +02:00
|
|
|
<p class=""><router-link :to="{ name: 'accounts' }" class="is-text">{{ $t('errors.refresh') }}</router-link></p>
|
2020-01-10 10:25:29 +01:00
|
|
|
</div>
|
|
|
|
<div v-else>
|
|
|
|
<p class="error-generic"></p>
|
2020-11-14 18:36:44 +01:00
|
|
|
<p>{{ $t('errors.error_occured') }} </p>
|
2022-05-19 15:50:06 +02:00
|
|
|
<p v-if="error.message" class="has-text-grey-lighter">{{ error.message }}</p>
|
2020-11-14 18:36:44 +01:00
|
|
|
<p v-if="error.originalMessage" class="has-text-grey-lighter">{{ error.originalMessage }}</p>
|
2022-05-19 15:50:06 +02:00
|
|
|
<p><router-link :to="{ name: 'accounts', params: { toRefresh: true } }" class="is-text">{{ $t('errors.refresh') }}</router-link></p>
|
2020-11-04 22:42:54 +01:00
|
|
|
<p v-if="debugMode == 'development' && error.debug">
|
2020-01-27 20:27:11 +01:00
|
|
|
<br>
|
2020-01-23 17:05:24 +01:00
|
|
|
{{ error.debug }}
|
2020-01-17 00:23:38 +01:00
|
|
|
</p>
|
2020-01-10 00:07:37 +01:00
|
|
|
</div>
|
|
|
|
</modal>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import Modal from '../components/Modal'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
data(){
|
|
|
|
return {
|
2020-01-10 15:00:55 +01:00
|
|
|
ShowModal : true,
|
2022-05-19 15:50:06 +02:00
|
|
|
showcloseButton: this.closable,
|
2020-01-10 00:07:37 +01:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2020-01-10 15:00:55 +01:00
|
|
|
computed: {
|
2020-01-23 17:05:24 +01:00
|
|
|
|
2020-01-10 15:00:55 +01:00
|
|
|
debugMode: function() {
|
|
|
|
return process.env.NODE_ENV
|
2020-01-17 00:23:38 +01:00
|
|
|
},
|
2020-01-23 17:05:24 +01:00
|
|
|
|
2020-01-17 00:23:38 +01:00
|
|
|
error: function() {
|
2022-05-19 15:50:06 +02:00
|
|
|
if( this.err === null || this.err === undefined ) {
|
2021-11-06 11:34:05 +01:00
|
|
|
return false
|
2020-01-23 17:05:24 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-05-19 15:50:06 +02:00
|
|
|
if (this.err.status === 407) {
|
|
|
|
return {
|
|
|
|
'message' : this.$t('errors.auth_proxy_failed'),
|
|
|
|
'originalMessage' : this.$t('errors.auth_proxy_failed_legend')
|
|
|
|
}
|
|
|
|
}
|
2023-02-17 17:12:53 +01:00
|
|
|
else if (this.err.status === 403) {
|
|
|
|
return {
|
|
|
|
'message' : this.$t('errors.unauthorized'),
|
|
|
|
'originalMessage' : this.$t('errors.unauthorized_legend')
|
|
|
|
}
|
|
|
|
}
|
2022-05-19 15:50:06 +02:00
|
|
|
else if(this.err.data) {
|
2020-01-23 17:05:24 +01:00
|
|
|
return this.err.data
|
|
|
|
}
|
2022-05-19 15:50:06 +02:00
|
|
|
else {
|
2020-11-04 22:42:54 +01:00
|
|
|
return { 'message' : this.err }
|
2020-01-23 17:05:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2020-01-10 15:00:55 +01:00
|
|
|
}
|
2020-01-23 17:05:24 +01:00
|
|
|
|
2020-01-10 15:00:55 +01:00
|
|
|
},
|
|
|
|
|
2022-05-19 15:50:06 +02:00
|
|
|
props: {
|
|
|
|
err: [String, Object], // on object (error.response) or a string
|
|
|
|
closable: {
|
|
|
|
type: Boolean,
|
|
|
|
default: true
|
|
|
|
}
|
|
|
|
},
|
2020-01-10 15:00:55 +01:00
|
|
|
|
2020-01-10 00:07:37 +01:00
|
|
|
components: {
|
|
|
|
Modal
|
|
|
|
},
|
|
|
|
|
|
|
|
mounted(){
|
|
|
|
// stop OTP generation on modal close
|
|
|
|
this.$on('modalClose', function() {
|
2023-08-21 14:46:05 +02:00
|
|
|
window.history.length > 1 ? this.$router.go(-1) : this.$router.push({ name: 'accounts '})
|
2020-01-10 00:07:37 +01:00
|
|
|
});
|
|
|
|
|
2021-11-06 11:34:05 +01:00
|
|
|
},
|
2023-09-14 13:39:48 +02:00
|
|
|
|
|
|
|
beforeRouteEnter(to, from, next) {
|
|
|
|
next(vm => {
|
|
|
|
if (from.params.returnTo) {
|
|
|
|
to.params.returnTo = from.params.returnTo
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
2020-01-10 00:07:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|