This commit is contained in:
Xuan Loi
2025-12-05 17:53:49 +07:00
commit 56f3509d4d
187 changed files with 30840 additions and 0 deletions

65
.nuxt/store.js Normal file
View File

@@ -0,0 +1,65 @@
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
let store = {};
(function updateModules () {
store = normalizeRoot(require('../store/index.js'), 'store/index.js')
// If store is an exported method = classic mode (deprecated)
if (typeof store === 'function') {
return console.warn('Classic mode for store/ is deprecated and will be removed in Nuxt 3.')
}
// Enforce store modules
store.modules = store.modules || {}
// If the environment supports hot reloading...
if (process.client && module.hot) {
// Whenever any Vuex module is updated...
module.hot.accept([
'../store/index.js',
], () => {
// Update `root.modules` with the latest definitions.
updateModules()
// Trigger a hot update in the store.
window.$nuxt.$store.hotUpdate(store)
})
}
})()
// createStore
export const createStore = store instanceof Function ? store : () => {
return new Vuex.Store(Object.assign({
strict: (process.env.NODE_ENV !== 'production')
}, store))
}
function normalizeRoot (moduleData, filePath) {
moduleData = moduleData.default || moduleData
if (moduleData.commit) {
throw new Error(`[nuxt] ${filePath} should export a method that returns a Vuex instance.`)
}
if (typeof moduleData !== 'function') {
// Avoid TypeError: setting a property that has only a getter when overwriting top level keys
moduleData = Object.assign({}, moduleData)
}
return normalizeModule(moduleData, filePath)
}
function normalizeModule (moduleData, filePath) {
if (moduleData.state && typeof moduleData.state !== 'function') {
console.warn(`'state' should be a method that returns an object in ${filePath}`)
const state = Object.assign({}, moduleData.state)
// Avoid TypeError: setting a property that has only a getter when overwriting top level keys
moduleData = Object.assign({}, moduleData, { state: () => state })
}
return moduleData
}