@@ 1-43 (lines=43) @@ | ||
1 | import axios from 'axios' |
|
2 | import Cookies from 'js-cookie' |
|
3 | import * as types from '../mutation-types' |
|
4 | ||
5 | // state |
|
6 | export const state = { |
|
7 | code: null, |
|
8 | uploader: null |
|
9 | } |
|
10 | ||
11 | // getters |
|
12 | export const getters = { |
|
13 | code: state => state.code, |
|
14 | uploader: state => state.uploader, |
|
15 | } |
|
16 | ||
17 | // mutations |
|
18 | export const mutations = { |
|
19 | ||
20 | [types.CODE_SAVE] (state, { code }) { |
|
21 | state.code = code |
|
22 | }, |
|
23 | [types.CODE_UPDATE] (state, { code }) { |
|
24 | state.code = code |
|
25 | }, |
|
26 | [types.Uploader] (state, { uploader }) { |
|
27 | state.uploader = uploader |
|
28 | } |
|
29 | } |
|
30 | ||
31 | // actions |
|
32 | export const actions = { |
|
33 | saveCode ({ commit, dispatch }, payload) { |
|
34 | commit(types.CODE_SAVE, payload) |
|
35 | }, |
|
36 | ||
37 | updateCode ({ commit }, payload) { |
|
38 | commit(types.CODE_UPDATE, payload) |
|
39 | }, |
|
40 | setUploader: function({commit, dispatch}, payload) { |
|
41 | commit(types.Uploader, payload) |
|
42 | }, |
|
43 | } |
|
44 |
@@ 1-43 (lines=43) @@ | ||
1 | import axios from 'axios' |
|
2 | import Cookies from 'js-cookie' |
|
3 | import * as types from '../mutation-types' |
|
4 | ||
5 | // state |
|
6 | export const state = { |
|
7 | code: null, |
|
8 | uploader: null |
|
9 | } |
|
10 | ||
11 | // getters |
|
12 | export const getters = { |
|
13 | code: state => state.code, |
|
14 | uploader: state => state.uploader, |
|
15 | } |
|
16 | ||
17 | // mutations |
|
18 | export const mutations = { |
|
19 | ||
20 | [types.CODE_SAVE] (state, { code }) { |
|
21 | state.code = code |
|
22 | }, |
|
23 | [types.CODE_UPDATE] (state, { code }) { |
|
24 | state.code = code |
|
25 | }, |
|
26 | [types.Uploader] (state, { uploader }) { |
|
27 | state.uploader = uploader |
|
28 | } |
|
29 | } |
|
30 | ||
31 | // actions |
|
32 | export const actions = { |
|
33 | saveCode ({ commit, dispatch }, payload) { |
|
34 | commit(types.CODE_SAVE, payload) |
|
35 | }, |
|
36 | ||
37 | updateCode ({ commit }, payload) { |
|
38 | commit(types.CODE_UPDATE, payload) |
|
39 | }, |
|
40 | setUploader: function({commit, dispatch}, payload) { |
|
41 | commit(types.Uploader, payload) |
|
42 | }, |
|
43 | } |
|
44 |
@@ 1-43 (lines=43) @@ | ||
1 | import axios from 'axios' |
|
2 | import Cookies from 'js-cookie' |
|
3 | import * as types from '../mutation-types' |
|
4 | ||
5 | // state |
|
6 | export const state = { |
|
7 | code: null, |
|
8 | uploader: null |
|
9 | } |
|
10 | ||
11 | // getters |
|
12 | export const getters = { |
|
13 | code: state => state.code, |
|
14 | uploader: state => state.uploader, |
|
15 | } |
|
16 | ||
17 | // mutations |
|
18 | export const mutations = { |
|
19 | ||
20 | [types.CODE_SAVE] (state, { code }) { |
|
21 | state.code = code |
|
22 | }, |
|
23 | [types.CODE_UPDATE] (state, { code }) { |
|
24 | state.code = code |
|
25 | }, |
|
26 | [types.Uploader] (state, { uploader }) { |
|
27 | state.uploader = uploader |
|
28 | } |
|
29 | } |
|
30 | ||
31 | // actions |
|
32 | export const actions = { |
|
33 | saveCode ({ commit, dispatch }, payload) { |
|
34 | commit(types.CODE_SAVE, payload) |
|
35 | }, |
|
36 | ||
37 | updateCode ({ commit }, payload) { |
|
38 | commit(types.CODE_UPDATE, payload) |
|
39 | }, |
|
40 | setUploader: function({commit, dispatch}, payload) { |
|
41 | commit(types.Uploader, payload) |
|
42 | }, |
|
43 | } |
|
44 |