Client - minor fixes

This commit is contained in:
Sam 2022-09-19 14:00:49 +02:00
parent b216900031
commit 6e04791b2d
2 changed files with 21 additions and 1 deletions

View File

@ -1,5 +1,6 @@
<template> <template>
<Error <Error
v-if="errorDisplayed"
title="404" title="404"
:message="$t(`error.NOT_FOUND.${target}`)" :message="$t(`error.NOT_FOUND.${target}`)"
:button-text="$t('common.HOME')" :button-text="$t('common.HOME')"
@ -7,7 +8,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { toRefs, withDefaults } from 'vue' import { Ref, onMounted, ref, toRefs, withDefaults, onUnmounted } from 'vue'
import Error from '@/components/Common/Error.vue' import Error from '@/components/Common/Error.vue'
interface Props { interface Props {
@ -17,4 +18,20 @@
target: 'PAGE', target: 'PAGE',
}) })
const { target } = toRefs(props) 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> </script>

View File

@ -145,6 +145,7 @@
import { import {
ComputedRef, ComputedRef,
computed, computed,
onUnmounted,
reactive, reactive,
ref, ref,
toRefs, toRefs,
@ -262,6 +263,8 @@
formData.password = '' formData.password = ''
} }
onUnmounted(() => store.commit(ROOT_STORE.MUTATIONS.EMPTY_ERROR_MESSAGES))
watch( watch(
() => route.path, () => route.path,
async () => { async () => {