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

@ -12,7 +12,8 @@ import useOcrStore from 'stores/ocr';
import useCustomerStore from 'stores/customer';
import useEmployeeStore from 'stores/employee';
import useMyBranchStore from 'stores/my-branch';
import useUtilsStore, { dialog, notify, resetScrollBar } from 'stores/utils';
import { dialog, notify, resetScrollBar } from 'stores/utils';
import { useNavigator } from 'src/stores/navigator';
import useFlowStore from 'stores/flow';
import { Status } from 'stores/types';
import {
@ -81,7 +82,7 @@ const $q = useQuasar();
const route = useRoute();
const router = useRouter();
const flowStore = useFlowStore();
const utilsStore = useUtilsStore();
const navigatorStore = useNavigator();
const customerStore = useCustomerStore();
const userBranchStore = useMyBranchStore();
const employeeStore = useEmployeeStore();
@ -112,8 +113,8 @@ const { state: employeeFormState, currentFromDataEmployee } =
storeToRefs(employeeFormStore);
async function init() {
utilsStore.currentTitle.title = 'menu.customer';
utilsStore.currentTitle.path = [
navigatorStore.current.title = 'menu.customer';
navigatorStore.current.path = [
{
text: 'menu.customerCaption',
i18n: true,
@ -133,7 +134,7 @@ async function init() {
if (_data) {
currentCustomer.value = _data;
utilsStore.currentTitle.path.push({
navigatorStore.current.path.push({
text: `${
_data.customerType === 'CORP'
? _data.branch[0].registerName