|
@@ -0,0 +1,33 @@
|
|
|
+import api from '@/api'
|
|
|
+import { Page } from '@/api/queries'
|
|
|
+
|
|
|
+
|
|
|
+export default {
|
|
|
+ state: {
|
|
|
+ welcome: undefined,
|
|
|
+ intro: undefined,
|
|
|
+ ids: {
|
|
|
+ welcome: 1,
|
|
|
+ intro: 207
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ mutations: {
|
|
|
+ 'SET_PAGE' (state, { slug, page }) {
|
|
|
+ state[slug] = page
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ actions: {
|
|
|
+ async 'QUERY_PAGE' ({ state, commit, dispatch, getters }, slug) {
|
|
|
+ if (state[slug] !== undefined) return state[slug]
|
|
|
+ return api.query(Page, { id: state.ids[slug] }).then(data => {
|
|
|
+ commit('SET_PAGE', { slug, page: data.page })
|
|
|
+ return state[slug]
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ getters: {
|
|
|
+ }
|
|
|
+}
|