|
|
@@ -1,8 +1,8 @@
|
|
|
export const state = () => ({
|
|
|
- // kinds: {
|
|
|
- // fetching: false,
|
|
|
- // data: []
|
|
|
- // },
|
|
|
+ kinds: {
|
|
|
+ fetching: false,
|
|
|
+ data: []
|
|
|
+ },
|
|
|
kindsParentWithBother: {
|
|
|
fetching: false,
|
|
|
data: []
|
|
|
@@ -22,41 +22,41 @@ export const state = () => ({
|
|
|
})
|
|
|
|
|
|
export const mutations = {
|
|
|
- // REQUEST_KIND (state, action) {
|
|
|
- // if (!action.id) {
|
|
|
- // state.kinds.fetching = true
|
|
|
- // } else {
|
|
|
- // const kind = state.kinds.data.find(kind => Object.is(kind.id, action.id))
|
|
|
- // if (kind) {
|
|
|
- // kind.fetching = true
|
|
|
- // }
|
|
|
- // }
|
|
|
- // },
|
|
|
- // GET_KIND_FAILURE (state, action) {
|
|
|
- // if (!action.id) {
|
|
|
- // state.kinds.fetching = false
|
|
|
- // } else {
|
|
|
- // const kind = state.kinds.data.find(kind => Object.is(kind.id, action.id))
|
|
|
- // if (kind) {
|
|
|
- // kind.fetching = false
|
|
|
- // }
|
|
|
- // }
|
|
|
- // },
|
|
|
- // GET_KIND_SUCCESS (state, action) {
|
|
|
- // if (!action.id) {
|
|
|
- // state.kinds.fetching = false
|
|
|
- // action.result.forEach(kind => {
|
|
|
- // kind.fetching = false
|
|
|
- // })
|
|
|
- // state.kinds.data = action.result
|
|
|
- // } else {
|
|
|
- // const kind = state.kinds.data.find(kind => Object.is(kind.id, action.id))
|
|
|
- // if (kind) {
|
|
|
- // kind.fetching = false
|
|
|
- // kind.children = action.result
|
|
|
- // }
|
|
|
- // }
|
|
|
- // },
|
|
|
+ REQUEST_KIND (state, action) {
|
|
|
+ if (!action.id) {
|
|
|
+ state.kinds.fetching = true
|
|
|
+ } else {
|
|
|
+ const kind = state.kinds.data.find(kind => Object.is(kind.id, action.id))
|
|
|
+ if (kind) {
|
|
|
+ kind.fetching = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ GET_KIND_FAILURE (state, action) {
|
|
|
+ if (!action.id) {
|
|
|
+ state.kinds.fetching = false
|
|
|
+ } else {
|
|
|
+ const kind = state.kinds.data.find(kind => Object.is(kind.id, action.id))
|
|
|
+ if (kind) {
|
|
|
+ kind.fetching = false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ GET_KIND_SUCCESS (state, action) {
|
|
|
+ if (!action.id) {
|
|
|
+ state.kinds.fetching = false
|
|
|
+ action.result.forEach(kind => {
|
|
|
+ kind.fetching = false
|
|
|
+ })
|
|
|
+ state.kinds.data = action.result
|
|
|
+ } else {
|
|
|
+ const kind = state.kinds.data.find(kind => Object.is(kind.id, action.id))
|
|
|
+ if (kind) {
|
|
|
+ kind.fetching = false
|
|
|
+ kind.children = action.result
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
REQUEST_KINDPARENTSWITHBOTHERS (state) {
|
|
|
state.kindsParentWithBother.fetching = true
|
|
|
},
|