From 3d1bb0c67a035e770f6aa02cf84e51307d9a9c8b Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 17 Sep 2024 10:20:44 +0200 Subject: [PATCH] fix(itemDescriptor): fix redirection to itemDiary --- src/components/common/VnCard.vue | 10 +++++++--- src/pages/Item/Card/ItemCard.vue | 2 +- src/pages/Item/Card/ItemDescriptor.vue | 1 + src/pages/Login/ResetPassword.vue | 1 - 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/components/common/VnCard.vue b/src/components/common/VnCard.vue index 7d29da232..0d80f43ce 100644 --- a/src/components/common/VnCard.vue +++ b/src/components/common/VnCard.vue @@ -24,7 +24,9 @@ const stateStore = useStateStore(); const route = useRoute(); const router = useRouter(); const url = computed(() => { - if (props.baseUrl) return `${props.baseUrl}/${route.params.id}`; + if (props.baseUrl) { + return `${props.baseUrl}/${route.params.id}`; + } return props.customUrl; }); const searchRightDataKey = computed(() => { @@ -40,8 +42,10 @@ onBeforeMount(async () => { try { if (!props.baseUrl) arrayData.store.filter.where = { id: route.params.id }; await arrayData.fetch({ append: false, updateRouter: false }); - } catch (e) { - router.push({ name: 'WorkerList' }); + } catch { + const { matched: matches } = router.currentRoute.value; + const { path } = matches.at(-1); + router.push({ path: path.replace(/:id.*/, '') }); } }); diff --git a/src/pages/Item/Card/ItemCard.vue b/src/pages/Item/Card/ItemCard.vue index 1162327c1..2412f2bf9 100644 --- a/src/pages/Item/Card/ItemCard.vue +++ b/src/pages/Item/Card/ItemCard.vue @@ -12,7 +12,7 @@ import ItemListFilter from '../ItemListFilter.vue'; search-data-key="ItemList" :searchbar-props="{ url: 'Items/filter', - label: 'searchbar.labelr', + label: 'searchbar.label', info: 'searchbar.info', }" /> diff --git a/src/pages/Item/Card/ItemDescriptor.vue b/src/pages/Item/Card/ItemDescriptor.vue index da6859d30..ef844824f 100644 --- a/src/pages/Item/Card/ItemDescriptor.vue +++ b/src/pages/Item/Card/ItemDescriptor.vue @@ -199,6 +199,7 @@ const openCloneDialog = async () => {