refactor: extract navigator into store instead

This commit is contained in:
Methapon Metanipat 2024-10-30 11:55:43 +07:00
parent caa3e59777
commit 6b29d3b017
10 changed files with 68 additions and 76 deletions

View file

@ -48,7 +48,8 @@ const { currentMyBranch } = storeToRefs(userBranchStore);
import { Status } from 'stores/types';
import useUtilsStore, { dialog, dialogWarningClose } from 'stores/utils';
import { dialog, dialogWarningClose } from 'stores/utils';
import { useNavigator } from 'src/stores/navigator';
import useProductServiceStore from 'stores/product-service';
import {
@ -66,7 +67,7 @@ import { computed } from 'vue';
import { WorkflowTemplate } from 'src/stores/workflow-template/types';
const flowStore = useFlowStore();
const utilsStore = useUtilsStore();
const navigatorStore = useNavigator();
const productServiceStore = useProductServiceStore();
const optionStore = useOptionStore();
@ -1463,8 +1464,8 @@ async function fetchImageList(
}
onMounted(async () => {
utilsStore.currentTitle.title = 'productService.title';
utilsStore.currentTitle.path = [
navigatorStore.current.title = 'productService.title';
navigatorStore.current.path = [
{
text: 'productService.caption',
i18n: true,
@ -1489,7 +1490,7 @@ watch(
inputSearch.value = '';
currentStatus.value = 'All';
let tmp: typeof utilsStore.currentTitle.path = [
let tmp: typeof navigatorStore.current.path = [
{
text: 'productService.caption',
i18n: true,
@ -1521,12 +1522,12 @@ watch(
filterStat.value = [];
productMode.value = 'group';
expandedTree.value.pop();
utilsStore.currentTitle.path.pop();
navigatorStore.current.path.pop();
}
},
});
if (expandedTree.value.length === 0) {
utilsStore.currentTitle.path = [
navigatorStore.current.path = [
{ text: 'productService.caption', i18n: true },
];
return;
@ -1546,7 +1547,7 @@ watch(
});
}
utilsStore.currentTitle.path = tmp;
navigatorStore.current.path = tmp;
},
{ deep: true },
);