import type { SiteType } from '~/types/sys/site'; import type { GridCodeType } from '~/types'; import { defineStore } from 'pinia'; import { computed, ref } from 'vue'; import { useAxios } from '~/composables/useAxios'; export const useLoadingStore = defineStore('useLoadingStore', () => { const loadCount = ref(0); const incrementLoadCount = () => { loadCount.value++; }; const decrementLoadCount = () => { loadCount.value--; }; const resetLoadCount = () => { loadCount.value = 0; }; const isLoading = computed(() => { return loadCount.value > 0; }); return { isLoading, resetLoadCount, incrementLoadCount, decrementLoadCount }; }); export const useDefaultStore = defineStore('useDefaultStore', () => { const siteInfo = ref({ siteId: '', siteName: '', siteDescription: '', siteDomain: '', siteType: '', sitePrefix: '', siteLocale: '', siteLogo: '', bscUrl: '', lgnUrl: '', delYn: false, useYn: true, frstRgtrId: '', frstRegDt: '', lastMdfrId: '', lastMdfcnDt: '' }); const fetchSiteInfo = async () => { const { data } = await useAxios().get('/api/admin/siteInfo'); siteInfo.value = data; }; return { siteInfo, fetchSiteInfo }; }); export const useCommonCodeStore = defineStore('useCommonCodeStore', () => { const searchSiteCodeList = async (): Promise => { const { data } = await useAxios().get('/api/admin/code/siteList'); return data; }; const searchInstCodeList = async (): Promise => { const { data } = await useAxios().get( '/api/admin/code/instList' ); return data; }; return { searchInstCodeList, searchSiteCodeList }; });