access the store



  • Hi,
    I am trying to access the store.state.xxx but I cannot, I am new with this technology and I have been confused

    import Vue from 'vue'
    import VueRouter from 'vue-router'
    
    import routes from './routes'
    import store from 'src/store/'
    
    
    Vue.use(VueRouter)
    
    /*
     * If not building with SSR mode, you can
     * directly export the Router instantiation;
     *
     * The function below can be async too; either use
     * async/await or return a Promise which resolves
     * with the Router instance.
     */
    
    export default function ( {router, store, Vue}/* { store, ssrContext } */) {
      const Router = new VueRouter({
        scrollBehavior: () => ({ x: 0, y: 0 }),
        routes,
    
        // Leave these as they are and change in quasar.conf.js instead!
        // quasar.conf.js -> build -> vueRouterMode
        // quasar.conf.js -> build -> publicPath
        mode: process.env.VUE_ROUTER_MODE,
        base: process.env.VUE_ROUTER_BASE
      })
    
    
      Router.beforeEach((to, from, next) => {
        if (to.matched.some(record => record.meta.requiresAuth)) {
          // this route requires auth, check if logged in
          // if not, redirect to login page.
    
          if (!store.state.loggedIn) {
            next({
              name: 'Security/Login',
    
            })
          } else {
            next()
          }
        } else {
          next() // make sure to always call next()!
        }
      })
    
      return Router
    }
    
    
    
    

    this my store:

    import { firebaseAuth, firebaseDb } from "boot/firebase";
    import { axiosInstance } from "boot/axios";
    
    const state = {
      TOKEN: null,
      loggedIn: false,
      userDetails: {},
      loading_login: false,
      currentPage: {
        title: "",
        IsActive: false
      },
    
      CONFIGSYS: {
        COMPANY_ID: 0
      }
    };
    
    

    😰

    Thanks in advance



  • import { firebaseAuth, firebaseDb } from "boot/firebase";
    import { axiosInstance } from "boot/axios";
    
    const state = {
      TOKEN: null,
      loggedIn: false,
      userDetails: {},
      loading_login: false,
      currentPage: {
        title: "",
        IsActive: false
      },
    
      CONFIGSYS: {
        COMPANY_ID: 0
      }
    };
    
    export default state <-- Add this at the bottom
    



Log in to reply