index.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. import SEO from './Seo'
  2. import Auth from './Auth'
  3. import Shop from './Shop'
  4. import Test from './Test'
  5. import process from 'process'
  6. import Widgets from './Widgets'
  7. import { createStore } from 'vuex'
  8. import AppLayout from './AppLayout'
  9. import PageBuilder from './PageBuilder'
  10. import { store } from 'quasar/wrappers'
  11. import createPersistedState from 'vuex-persistedstate'
  12. const plugins = []
  13. if (process.browser) {
  14. const vuexPersistedState =
  15. createPersistedState({
  16. key: 'vuex',
  17. storage: window.localStorage,
  18. fetchBeforeUse: true,
  19. paths: [
  20. 'Shop',
  21. 'Auth.user',
  22. 'Auth.redirectTo',
  23. 'Auth.accessToken'
  24. ]
  25. })
  26. plugins.push(vuexPersistedState)
  27. }
  28. /*
  29. * If not building with SSR mode, you can
  30. * directly export the Store instantiation;
  31. *
  32. * The function below can be async too; either use
  33. * async/await or return a Promise which resolves
  34. * with the Store instance.
  35. */
  36. const debug = false
  37. export default store(function (/* { ssrContext } */) {
  38. const Store = createStore({
  39. modules: {
  40. SEO,
  41. Shop,
  42. Test,
  43. Auth,
  44. Widgets,
  45. AppLayout,
  46. PageBuilder
  47. },
  48. plugins,
  49. // enable strict mode (adds overhead!)
  50. // for dev mode and --debug builds only
  51. strict: debug
  52. })
  53. return Store
  54. })