2020-01-10 00:07:37 +01:00
|
|
|
<template>
|
2020-01-14 11:48:42 +01:00
|
|
|
<div class="error-message">
|
2020-01-10 00:07:37 +01:00
|
|
|
<modal v-model="ShowModal">
|
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>
|
2020-01-13 22:24:14 +01:00
|
|
|
<div v-else-if="$route.name == 'flooded'">
|
|
|
|
<p class="error-generic"></p>
|
2020-01-14 11:48:42 +01:00
|
|
|
<p>
|
|
|
|
{{ $t('errors.already_one_user_registered') }}<br>
|
|
|
|
{{ $t('errors.cannot_register_more_user') }}
|
|
|
|
</p>
|
2020-10-14 23:33:07 +02:00
|
|
|
<p><router-link :to="{ name: 'accounts' }" class="is-text">{{ $t('auth.sign_in') }}</router-link></p>
|
2020-01-13 22:24:14 +01:00
|
|
|
</div>
|
2020-01-10 10:25:29 +01:00
|
|
|
<div v-else>
|
|
|
|
<p class="error-generic"></p>
|
2020-11-14 18:36:44 +01:00
|
|
|
<p>{{ $t('errors.error_occured') }} </p>
|
2020-01-27 20:27:11 +01:00
|
|
|
<p v-if="error" 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>
|
2020-10-14 23:33:07 +02:00
|
|
|
<p><router-link :to="{ name: 'accounts' }" 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,
|
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() {
|
2021-11-06 11:34:05 +01:00
|
|
|
if( this.err == null ) {
|
|
|
|
return false
|
2020-01-23 17:05:24 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if(this.err.data) {
|
2020-11-04 22:42:54 +01:00
|
|
|
console.log(this.err.data)
|
2020-01-23 17:05:24 +01:00
|
|
|
return this.err.data
|
|
|
|
}
|
|
|
|
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
|
|
|
},
|
|
|
|
|
2021-11-06 11:34:05 +01:00
|
|
|
props: ['err'], // on object (error.response) or a string
|
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() {
|
|
|
|
this.$router.push({name: 'accounts' });
|
|
|
|
});
|
|
|
|
|
2021-11-06 11:34:05 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
beforeRouteEnter (to, from, next) {
|
|
|
|
|
|
|
|
next(vm => {
|
|
|
|
if( !vm.err ) {
|
|
|
|
next({ name: 'accounts' });
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
next();
|
|
|
|
},
|
2020-01-10 00:07:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|