Skip to content

Commit 59ea67b

Browse files
committed
disable vuex, add vue-stator, store/state.js
1 parent 59148f5 commit 59ea67b

5 files changed

Lines changed: 1895 additions & 1480 deletions

File tree

nuxt.config.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ export default {
2525
start_url: '/news'
2626
},
2727

28-
devModules: [
28+
buildModules: [
2929
'@nuxtjs/pwa',
30-
'@nuxtjs/axios'
30+
'@nuxtjs/axios',
31+
'vue-stator/nuxt'
3132
],
3233

3334
axios: {

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,12 @@
3030
},
3131
"dependencies": {
3232
"@nuxtjs/axios": "^5.5.3",
33-
"nuxt": "^2.8.0"
33+
"nuxt": "^2.10.1",
34+
"vue-stator": "^0.0.10"
3435
},
3536
"devDependencies": {
36-
"@nuxtjs/pwa": "3.0.0-beta.8",
3737
"@nuxtjs/eslint-config": "^0.0.1",
38+
"@nuxtjs/pwa": "3.0.0-beta.8",
3839
"babel-eslint": "^10.0.1",
3940
"eslint": "^5.16.0",
4041
"eslint-config-standard": "^12.0.0",

store/index.js

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,10 @@
11
import Vue from 'vue'
2+
import { CancelToken } from 'axios'
23

3-
import { validFeeds } from '~/common/api'
44
import { lazy } from '~/common/utils'
5-
import { CancelToken } from 'axios'
65

76
// Learn more on https://nuxtjs.org/guide/vuex-store
87

9-
// =================================================
10-
// State
11-
// =================================================
12-
export const state = () => {
13-
const s = {
14-
items: {
15-
/* [id: number]: Item */
16-
},
17-
users: {
18-
/* [id: string]: User */
19-
},
20-
feeds: {
21-
/* [page: number] : [ [id: number] ] */
22-
}
23-
}
24-
25-
validFeeds.forEach((feed) => {
26-
s.feeds[feed] = {}
27-
})
28-
29-
return s
30-
}
31-
328
// =================================================
339
// Mutations
3410
// =================================================

store/state.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// =================================================
2+
// State
3+
// =================================================
4+
import { validFeeds } from '~/common/api'
5+
6+
export default () => {
7+
const s = {
8+
items: {
9+
/* [id: number]: Item */
10+
},
11+
users: {
12+
/* [id: string]: User */
13+
},
14+
feeds: {
15+
/* [page: number] : [ [id: number] ] */
16+
}
17+
}
18+
19+
validFeeds.forEach((feed) => {
20+
s.feeds[feed] = {}
21+
})
22+
23+
return s
24+
}

0 commit comments

Comments
 (0)