Total Complexity | 5 |
Complexity/F | 1 |
Lines of Code | 33 |
Function Count | 5 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | export const state = () => ({ |
||
2 | site: {}, |
||
3 | config: {} |
||
4 | }) |
||
5 | |||
6 | export const mutations = { |
||
7 | setData (state, { key, value }) { |
||
8 | state[key] = value |
||
9 | } |
||
10 | } |
||
11 | |||
12 | export const actions = { |
||
13 | async nuxtServerInit ({ dispatch }) { |
||
14 | await dispatch('initSite') |
||
15 | await dispatch('initConfig') |
||
16 | await dispatch('news/initCategory') |
||
17 | }, |
||
18 | async initSite ({ commit }) { |
||
19 | const data = await this.$wp.site() |
||
20 | commit('setData', { |
||
21 | key: 'site', |
||
22 | value: data |
||
23 | }) |
||
24 | }, |
||
25 | async initConfig ({ commit }) { |
||
26 | const data = await this.$wp.options() |
||
27 | .id('rsl-fe-config') |
||
28 | commit('setData', { |
||
29 | key: 'config', |
||
30 | value: data.acf |
||
31 | }) |
||
32 | } |
||
33 | } |
||
34 |