diff --git a/src/pages/InvoiceIn/Card/InvoiceInCard.vue b/src/pages/InvoiceIn/Card/InvoiceInCard.vue index be92b6a8b..0fe2a2368 100644 --- a/src/pages/InvoiceIn/Card/InvoiceInCard.vue +++ b/src/pages/InvoiceIn/Card/InvoiceInCard.vue @@ -3,8 +3,8 @@ import VnCard from 'components/common/VnCard.vue'; import InvoiceInDescriptor from './InvoiceInDescriptor.vue'; import InvoiceInFilter from '../InvoiceInFilter.vue'; import InvoiceInSearchbar from '../InvoiceInSearchbar.vue'; -import axios from 'axios'; import { onBeforeRouteUpdate } from 'vue-router'; +import { setRectificative } from '../composables/setRectificative'; const filter = { include: [ @@ -23,19 +23,7 @@ const filter = { ], }; -onBeforeRouteUpdate(async (to) => { - const card = to.matched.find((route) => route.name === 'InvoiceInCard'); - const corrective = card.children.find( - (route) => route.name === 'InvoiceInCorrective' - ); - - const isRectificative = !!( - await axios.get('InvoiceInCorrections', { - params: { filter: { where: { correctingFk: to.params.id } } }, - }) - ).data.length; - corrective.meta.hidden = !isRectificative; -}); +onBeforeRouteUpdate(async (to) => await setRectificative(to));