...
|
...
|
@@ -2,9 +2,9 @@ import { |
|
|
FETCH_HOME_REQUEST,
|
|
|
FETCH_HOME_FAILURE,
|
|
|
FETCH_HOME_SUCCESS,
|
|
|
FETCH_CHANNEL_MAN_REQUEST,
|
|
|
FETCH_CHANNEL_MAN_SUCCESS,
|
|
|
FETCH_CHANNEL_MAN_FAILURE
|
|
|
FETCH_CHANNEL_REQUEST,
|
|
|
FETCH_CHANNEL_SUCCESS,
|
|
|
FETCH_CHANNEL_FAILURE
|
|
|
} from './types';
|
|
|
import {
|
|
|
HOME_CONTENT_CODE,
|
...
|
...
|
@@ -16,10 +16,16 @@ import _ from 'lodash'; |
|
|
export default {
|
|
|
state: {
|
|
|
home: {},
|
|
|
man: {},
|
|
|
gender: 'men',
|
|
|
man: {
|
|
|
data: {},
|
|
|
isFetching: false
|
|
|
},
|
|
|
woman: {
|
|
|
data: {},
|
|
|
isFetching: false
|
|
|
},
|
|
|
fethingHome: false,
|
|
|
fethingMan: false,
|
|
|
fethingWoman: false
|
|
|
},
|
|
|
mutations: {
|
|
|
[FETCH_HOME_REQUEST](state) {
|
...
|
...
|
@@ -32,15 +38,16 @@ export default { |
|
|
state.fethingHome = false;
|
|
|
state.home = data;
|
|
|
},
|
|
|
[FETCH_CHANNEL_MAN_REQUEST](state) {
|
|
|
state.fethingMan = true;
|
|
|
[FETCH_CHANNEL_REQUEST](state, gender) {
|
|
|
state.gender = gender;
|
|
|
state[gender].isFetching = true;
|
|
|
},
|
|
|
[FETCH_CHANNEL_MAN_FAILURE](state) {
|
|
|
state.fethingMan = false;
|
|
|
[FETCH_CHANNEL_FAILURE](state) {
|
|
|
state[state.gender].isFetching = false;
|
|
|
},
|
|
|
[FETCH_CHANNEL_MAN_SUCCESS](state, {data}) {
|
|
|
state.fethingMan = false;
|
|
|
state.man = data;
|
|
|
[FETCH_CHANNEL_SUCCESS](state, {data}) {
|
|
|
state[state.gender].isFetching = false;
|
|
|
state[state.gender].data = data;
|
|
|
},
|
|
|
},
|
|
|
actions: {
|
...
|
...
|
@@ -59,17 +66,19 @@ export default { |
|
|
commit(FETCH_HOME_FAILURE);
|
|
|
}
|
|
|
},
|
|
|
async [FETCH_CHANNEL_MAN_REQUEST]({commit, state}) {
|
|
|
commit(FETCH_CHANNEL_MAN_REQUEST);
|
|
|
async [FETCH_CHANNEL_REQUEST]({commit}, gender) {
|
|
|
commit(FETCH_CHANNEL_REQUEST, gender);
|
|
|
|
|
|
try {
|
|
|
const result = await this.$api.get('/resource/get', {content_code: CHANNEL_MAN_CONTENT_CODE});
|
|
|
const result = await this.$api.get('/resource/get', {
|
|
|
content_code: gender === 'man' ? CHANNEL_MAN_CONTENT_CODE : CHANNEL_WOMEN_CONTENT_CODE
|
|
|
});
|
|
|
|
|
|
console.log(result)
|
|
|
commit(FETCH_CHANNEL_MAN_SUCCESS, result);
|
|
|
commit(FETCH_CHANNEL_SUCCESS, result);
|
|
|
return result;
|
|
|
} catch (e) {
|
|
|
console.error(e);
|
|
|
commit(FETCH_CHANNEL_MAN_FAILURE);
|
|
|
commit(FETCH_CHANNEL_FAILURE);
|
|
|
}
|
|
|
}
|
|
|
}
|
...
|
...
|
|