Standardize store exports to named useXxxStore convention
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -14,25 +14,25 @@
|
||||
import { onBeforeMount, } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { storeToRefs, mapActions, mapState, } from 'pinia';
|
||||
import LoadingStore from '@/stores/loading.js';
|
||||
import AllMapDataStore from '@/stores/allMapData.js';
|
||||
import ConformanceStore from '@/stores/conformance.js';
|
||||
import { useLoadingStore } from '@/stores/loading.js';
|
||||
import { useAllMapDataStore } from '@/stores/allMapData.js';
|
||||
import { useConformanceStore } from '@/stores/conformance.js';
|
||||
import Header from "@/components/Header.vue";
|
||||
import Navbar from "@/components/Navbar.vue";
|
||||
import Loading from '@/components/Loading.vue';
|
||||
import { leaveFilter, leaveConformance } from '@/module/alertModal.js';
|
||||
import PageAdminStore from '@/stores/pageAdmin.js';
|
||||
import LoginStore from "@/stores/login";
|
||||
import { usePageAdminStore } from '@/stores/pageAdmin.js';
|
||||
import { useLoginStore } from "@/stores/login";
|
||||
import { getCookie, setCookie } from "@/utils/cookieUtil.js";
|
||||
import ModalContainer from './AccountManagement/ModalContainer.vue';
|
||||
|
||||
export default {
|
||||
name: 'MainContainer',
|
||||
setup() {
|
||||
const loadingStore = LoadingStore();
|
||||
const allMapDataStore = AllMapDataStore();
|
||||
const conformanceStore = ConformanceStore();
|
||||
const pageAdminStore = PageAdminStore();
|
||||
const loadingStore = useLoadingStore();
|
||||
const allMapDataStore = useAllMapDataStore();
|
||||
const conformanceStore = useConformanceStore();
|
||||
const pageAdminStore = usePageAdminStore();
|
||||
const { tempFilterId, createFilterId, temporaryData, postRuleData, ruleData } = storeToRefs(allMapDataStore);
|
||||
const { conformanceLogTempCheckId, conformanceFilterTempCheckId } = storeToRefs(conformanceStore);
|
||||
const router = useRouter();
|
||||
@@ -65,23 +65,23 @@ export default {
|
||||
ModalContainer,
|
||||
},
|
||||
computed: {
|
||||
...mapState(PageAdminStore, [
|
||||
...mapState(usePageAdminStore, [
|
||||
'shouldKeepPreviousPage',
|
||||
'activePageComputedByRoute'
|
||||
]),
|
||||
...mapState(LoginStore, [
|
||||
...mapState(useLoginStore, [
|
||||
'isLoggedIn',
|
||||
'auth',
|
||||
])
|
||||
},
|
||||
methods: {
|
||||
...mapActions(PageAdminStore, [
|
||||
...mapActions(usePageAdminStore, [
|
||||
'copyPendingPageToActivePage',
|
||||
'setPreviousPage',
|
||||
'clearShouldKeepPreviousPageBoolean',
|
||||
'setActivePageComputedByRoute',
|
||||
],),
|
||||
...mapActions(LoginStore, [
|
||||
...mapActions(useLoginStore, [
|
||||
'refreshToken',
|
||||
],),
|
||||
},
|
||||
@@ -100,7 +100,7 @@ export default {
|
||||
// }
|
||||
// }
|
||||
async beforeRouteEnter(to, from, next) {
|
||||
const loginStore = LoginStore();
|
||||
const loginStore = useLoginStore();
|
||||
|
||||
if (!getCookie("isLuciaLoggedIn")) { //這裡不要用pinia的isLoggedIn來檢查,因為會有重新整理時撈不到Persisted value的值的bug
|
||||
if (getCookie('luciaRefreshToken')) {
|
||||
|
||||
Reference in New Issue
Block a user