diff --git a/FrontEnd/nuxt.config.js b/FrontEnd/nuxt.config.js index 9844384..5ec2edb 100644 --- a/FrontEnd/nuxt.config.js +++ b/FrontEnd/nuxt.config.js @@ -94,7 +94,7 @@ export default { { src: "~/plugins/vueCompositionAPI" }, { src: "~/plugins/vue-scroll-to" }, { src: "~/plugins/photoswipe", mode: "client", ssr: false }, - { src: '@/plugins/router', ssr: false} + // { src: '@/plugins/router', ssr: false} // 先僅用路由前獲取OrgID ], // Auto import components: https://go.nuxtjs.dev/config-components diff --git a/FrontEnd/plugins/router.js b/FrontEnd/plugins/router.js new file mode 100644 index 0000000..827eb41 --- /dev/null +++ b/FrontEnd/plugins/router.js @@ -0,0 +1,10 @@ + +export default ({ app, store }) => { + app.router.beforeEach((to, from, next) => { + store.dispatch("toggleOrgID").then(() => { + next(); + }).catch(() => { + next(); + }); + }); +} \ No newline at end of file