Hangar/frontend/layouts/error.vue
Jake Potrebic e1ea6eb2c5
tiny issues
* formatting
* remove imports from 'vue-property-decorator'
* only notify of version reviews if its the last open review that is reviewed
2021-03-15 10:23:32 -07:00

56 lines
1.4 KiB
Vue

<template>
<v-card max-width="400" class="mx-auto">
<v-card-title v-text="error.statusCode" />
<v-card-text v-text="text" />
<v-card-actions class="text-center">
<v-btn nuxt to="/" color="secondary">
<v-icon left>mdi-home</v-icon>
Home
</v-btn>
</v-card-actions>
</v-card>
</template>
<script lang="ts">
import { PropType } from 'vue';
import { Component, Prop, Vue } from 'nuxt-property-decorator';
import { NuxtError } from '@nuxt/types';
@Component({
layout: 'empty',
})
export default class ErrorPage extends Vue {
pageNotFound = '404 Not Found';
unknownError = 'An error occurred';
@Prop({ type: Object as PropType<NuxtError>, default: () => null })
error!: NuxtError;
get text() {
switch (this.error.statusCode) {
case 404:
return this.pageNotFound;
case 401:
return 'You must be logged in for this';
case 403:
return 'You do not have permission to do that';
default:
return this.unknownError;
}
}
head() {
const title = this.error.statusCode === 404 ? this.pageNotFound : this.unknownError;
return {
title,
};
}
}
</script>
<style scoped>
h1 {
font-size: 20px;
}
</style>