Client - minor refactor

This commit is contained in:
Sam 2021-09-23 16:45:57 +02:00
parent 0cb4fae21e
commit e7fd6860d3
4 changed files with 37 additions and 10 deletions

View File

@ -0,0 +1,31 @@
<template>
<Error
title="404"
:message="t(`error.NOT_FOUND.${target}`)"
:button-text="t('common.HOME')"
/>
</template>
<script lang="ts">
import { defineComponent } from 'vue'
import { useI18n } from 'vue-i18n'
import Error from '@/components/Common/Error.vue'
export default defineComponent({
name: 'NotFoundView',
components: {
Error,
},
props: {
target: {
type: String,
default: 'PAGE',
},
},
setup() {
const { t } = useI18n()
return { t }
},
})
</script>

View File

@ -4,7 +4,7 @@ import store from '@/store'
import { USER_STORE } from '@/store/constants' import { USER_STORE } from '@/store/constants'
import Dashboard from '@/views/DashBoard.vue' import Dashboard from '@/views/DashBoard.vue'
import LoginOrRegister from '@/views/LoginOrRegister.vue' import LoginOrRegister from '@/views/LoginOrRegister.vue'
import NotFound from '@/views/NotFound.vue' import NotFoundView from '@/views/NotFoundView.vue'
const routes: Array<RouteRecordRaw> = [ const routes: Array<RouteRecordRaw> = [
{ {
@ -24,7 +24,7 @@ const routes: Array<RouteRecordRaw> = [
component: LoginOrRegister, component: LoginOrRegister,
props: { action: 'register' }, props: { action: 'register' },
}, },
{ path: '/:pathMatch(.*)*', name: 'not-found', component: NotFound }, { path: '/:pathMatch(.*)*', name: 'not-found', component: NotFoundView },
] ]
const router = createRouter({ const router = createRouter({

View File

@ -1,10 +1,6 @@
<template> <template>
<div class="not-found"> <div class="not-found">
<Error <NotFound />
title="404"
:message="t('error.NOT_FOUND.PAGE')"
:button-text="t('common.HOME')"
/>
</div> </div>
</template> </template>
@ -12,12 +8,12 @@
import { defineComponent } from 'vue' import { defineComponent } from 'vue'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import Error from '@/components/Error.vue' import NotFound from '@/components/Common/NotFound.vue'
export default defineComponent({ export default defineComponent({
name: 'NotFound', name: 'NotFoundView',
components: { components: {
Error, NotFound,
}, },
setup() { setup() {
const { t } = useI18n() const { t } = useI18n()