This commit is contained in:
Pacharapol Withayasakpunt committed 2019-12-25 00:11:26 +07:00
1 parent 36338ed0d7
commit 7fe8f5d154
96 files changed
+21326

No files matched your search

+28
View File
@@ -0,0 +1,28 @@
import { Store, ActionTree } from 'vuex'
import { initialiseStores } from '~/utils/store-accessor'
import { apiHash } from '~/assets/util'
const initializer = (store: Store<any>) => initialiseStores(store)
export const actions: ActionTree<any, any> = {
async nuxtServerInit ({ commit }) {
const [
hPosts,
hSlides,
tPosts,
] = await Promise.all([
apiHash('/build/hash/posts.json', Math.random().toString().substr(-5)),
apiHash('/build/hash/slides.json', Math.random().toString().substr(-5)),
apiHash('/build/tag/posts.json', Math.random().toString().substr(-5)),
])
commit('global/setHash', {
posts: JSON.parse(hPosts),
slides: JSON.parse(hSlides),
})
commit('global/setTag', JSON.parse(tPosts))
},
}
export const plugins = [initializer]
export * from '~/utils/store-accessor'