FitTrackee/fittrackee_client/src/components/Common/NotFound.vue
2022-09-19 14:00:56 +02:00

38 lines
820 B
Vue

<template>
<Error
v-if="errorDisplayed"
title="404"
:message="$t(`error.NOT_FOUND.${target}`)"
:button-text="$t('common.HOME')"
/>
</template>
<script setup lang="ts">
import { Ref, onMounted, ref, toRefs, withDefaults, onUnmounted } from 'vue'
import Error from '@/components/Common/Error.vue'
interface Props {
target?: string
}
const props = withDefaults(defineProps<Props>(), {
target: 'PAGE',
})
const { target } = toRefs(props)
const timer = ref<number | undefined>()
const errorDisplayed: Ref<boolean> = ref(false)
onMounted(() => displayError())
function displayError() {
timer.value = setTimeout(() => {
errorDisplayed.value = true
}, 500)
}
onUnmounted(() => {
if (timer.value) {
clearTimeout(timer.value)
}
})
</script>