refactor: deleted onUnmounted code
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Jon Elias 2024-12-09 08:20:35 +01:00
parent 646007ea63
commit 0c88db5931
13 changed files with 12 additions and 43 deletions

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref, onUnmounted, watch, onMounted } from 'vue'; import { ref, onUnmounted, watch } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute, useRouter } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
import axios from 'axios'; import axios from 'axios';
@ -370,10 +370,6 @@ async function clearFilter() {
await applyFilter(); await applyFilter();
} }
onMounted(() => {
stateStore.rightDrawer = true;
});
onUnmounted(() => { onUnmounted(() => {
stateStore.rightDrawer = false; stateStore.rightDrawer = false;
}); });

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { onMounted, computed, onUnmounted, reactive, ref, nextTick, watch } from 'vue'; import { onMounted, computed, reactive, ref, nextTick, watch } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute, useRouter } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
@ -145,8 +145,6 @@ onMounted(async () => {
await updateWarehouse(warehouseFk.value); await updateWarehouse(warehouseFk.value);
}); });
onUnmounted(() => (stateStore.rightDrawer = false));
watch( watch(
() => router.currentRoute.value.params.id, () => router.currentRoute.value.params.id,
(newId) => { (newId) => {

View File

@ -1,12 +1,10 @@
<script setup> <script setup>
import { onMounted, computed, onUnmounted, ref, watch } from 'vue'; import { onMounted, computed, ref, watch } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { dateRange } from 'src/filters'; import { dateRange } from 'src/filters';
import EntryDescriptorProxy from 'src/pages/Entry/Card/EntryDescriptorProxy.vue'; import EntryDescriptorProxy from 'src/pages/Entry/Card/EntryDescriptorProxy.vue';
import VnInputDate from 'src/components/common/VnInputDate.vue'; import VnInputDate from 'src/components/common/VnInputDate.vue';
import { useStateStore } from 'stores/useStateStore';
import { toDateTimeFormat } from 'src/filters/date.js'; import { toDateTimeFormat } from 'src/filters/date.js';
import { dashIfEmpty } from 'src/filters'; import { dashIfEmpty } from 'src/filters';
import { toCurrency } from 'filters/index'; import { toCurrency } from 'filters/index';
@ -15,7 +13,6 @@ import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute(); const route = useRoute();
const stateStore = useStateStore();
const exprBuilder = (param, value) => { const exprBuilder = (param, value) => {
switch (param) { switch (param) {
@ -180,8 +177,6 @@ onMounted(async () => {
updateFilter(); updateFilter();
}); });
}); });
onUnmounted(() => (stateStore.rightDrawer = false));
</script> </script>
<template> <template>

View File

@ -60,8 +60,6 @@ const decrement = (paramsObj, key) => {
}; };
onMounted(async () => { onMounted(async () => {
// Fill fieldFiltersValues with existent userParams
console.log('arrayData: ', arrayData.store?.userParams);
if (arrayData.store?.userParams) { if (arrayData.store?.userParams) {
fieldFiltersValues.value = Object.entries(arrayData.store.userParams).map( fieldFiltersValues.value = Object.entries(arrayData.store.userParams).map(
([key, value]) => ({ ([key, value]) => ({
@ -72,7 +70,6 @@ onMounted(async () => {
); );
} }
exprBuilder('state', arrayData.store?.userParams?.state); exprBuilder('state', arrayData.store?.userParams?.state);
console.log('fieldFiltersValues.value: ', fieldFiltersValues.value);
}); });
</script> </script>

View File

@ -1,7 +1,7 @@
<script setup> <script setup>
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
import { useRoute, useRouter } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
import { onMounted, onUnmounted, ref, computed, watch } from 'vue'; import { onMounted, ref, computed, watch } from 'vue';
import axios from 'axios'; import axios from 'axios';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import VnPaginate from 'src/components/ui/VnPaginate.vue'; import VnPaginate from 'src/components/ui/VnPaginate.vue';
@ -29,8 +29,6 @@ onMounted(() => {
checkOrderConfirmation(); checkOrderConfirmation();
}); });
onUnmounted(() => (stateStore.rightDrawer = false));
async function checkOrderConfirmation() { async function checkOrderConfirmation() {
const response = await axios.get(`Orders/${route.params.id}`); const response = await axios.get(`Orders/${route.params.id}`);
if (response.data.isConfirmed === 1) { if (response.data.isConfirmed === 1) {

View File

@ -2,7 +2,7 @@
import VnPaginate from 'components/ui/VnPaginate.vue'; import VnPaginate from 'components/ui/VnPaginate.vue';
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { onMounted, onUnmounted } from 'vue'; import { onMounted } from 'vue';
import CardList from 'components/ui/CardList.vue'; import CardList from 'components/ui/CardList.vue';
import VnLv from 'components/ui/VnLv.vue'; import VnLv from 'components/ui/VnLv.vue';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
@ -21,7 +21,6 @@ const filter = {
}; };
onMounted(() => (stateStore.rightDrawer = true)); onMounted(() => (stateStore.rightDrawer = true));
onUnmounted(() => (stateStore.rightDrawer = false));
function navigate(id) { function navigate(id) {
router.push({ path: `/shelving/${id}` }); router.push({ path: `/shelving/${id}` });

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref, computed, onMounted, onUnmounted, watch } from 'vue'; import { ref, computed, onMounted, watch } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue'; import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
@ -134,8 +134,6 @@ onMounted(() => {
loadDefaultTicketAction(); loadDefaultTicketAction();
ticketHaveNegatives(); ticketHaveNegatives();
}); });
onUnmounted(() => (stateStore.rightDrawer = false));
</script> </script>
<template> <template>

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref, computed, onMounted, onUnmounted, watch, nextTick } from 'vue'; import { ref, computed, onMounted, watch, nextTick } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
@ -168,8 +168,6 @@ const getTicketVolume = async () => {
onMounted(() => { onMounted(() => {
stateStore.rightDrawer = true; stateStore.rightDrawer = true;
}); });
onUnmounted(() => (stateStore.rightDrawer = false));
</script> </script>
<template> <template>

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { onMounted, ref, computed, onUnmounted } from 'vue'; import { onMounted, ref, computed } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
@ -197,8 +197,6 @@ onMounted(async () => {
const filteredColumns = columns.value.filter((col) => col.name !== 'history'); const filteredColumns = columns.value.filter((col) => col.name !== 'history');
allColumnNames.value = filteredColumns.map((col) => col.name); allColumnNames.value = filteredColumns.map((col) => col.name);
}); });
onUnmounted(() => (stateStore.rightDrawer = false));
</script> </script>
<template> <template>

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { onMounted, ref, computed, onUnmounted, watch } from 'vue'; import { onMounted, ref, computed, watch } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRouter, useRoute } from 'vue-router'; import { useRouter, useRoute } from 'vue-router';
import { useQuasar } from 'quasar'; import { useQuasar } from 'quasar';
@ -421,8 +421,6 @@ onMounted(async () => {
getConfig(); getConfig();
}); });
onUnmounted(() => (stateStore.rightDrawer = false));
const items = ref([]); const items = ref([]);
const newRow = ref({}); const newRow = ref({});

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref, computed, onMounted, onUnmounted, watch, nextTick } from 'vue'; import { ref, computed, onMounted, watch, nextTick } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
@ -90,8 +90,6 @@ const applyVolumes = async (salesData) => {
}; };
onMounted(() => (stateStore.rightDrawer = true)); onMounted(() => (stateStore.rightDrawer = true));
onUnmounted(() => (stateStore.rightDrawer = false));
</script> </script>
<template> <template>

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { onMounted, ref, computed, onUnmounted } from 'vue'; import { onMounted, ref, computed } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import VnSelect from 'src/components/common/VnSelect.vue'; import VnSelect from 'src/components/common/VnSelect.vue';
import VnSelectCache from 'src/components/common/VnSelectCache.vue'; import VnSelectCache from 'src/components/common/VnSelectCache.vue';
@ -170,8 +170,6 @@ onMounted(async () => {
const filteredColumns = columns.value.filter((col) => col.name !== 'actions'); const filteredColumns = columns.value.filter((col) => col.name !== 'actions');
allColumnNames.value = filteredColumns.map((col) => col.name); allColumnNames.value = filteredColumns.map((col) => col.name);
}); });
onUnmounted(() => (stateStore.rightDrawer = false));
</script> </script>
<template> <template>

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref, onUnmounted } from 'vue'; import { ref } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import ZoneEventsPanel from './ZoneEventsPanel.vue'; import ZoneEventsPanel from './ZoneEventsPanel.vue';
@ -40,8 +40,6 @@ const onZoneEventFormClose = () => {
showZoneEventForm.value = false; showZoneEventForm.value = false;
zoneEventsFormProps.value = {}; zoneEventsFormProps.value = {};
}; };
onUnmounted(() => (stateStore.rightDrawer = false));
</script> </script>
<template> <template>