...
|
...
|
@@ -2,9 +2,11 @@ import { |
|
|
FETCH_HOME_REQUEST,
|
|
|
FETCH_HOME_FAILURE,
|
|
|
FETCH_HOME_SUCCESS,
|
|
|
REFRESH_HOME_RESET,
|
|
|
FETCH_CHANNEL_REQUEST,
|
|
|
FETCH_CHANNEL_SUCCESS,
|
|
|
FETCH_CHANNEL_FAILURE,
|
|
|
REFRESH_CHANNEL_RESET,
|
|
|
FETCH_ABOUT_REQUEST,
|
|
|
FETCH_ABOUT_SUCCESS,
|
|
|
FETCH_ABOUT_FAILURE
|
...
|
...
|
@@ -22,7 +24,7 @@ export function createChannel() { |
|
|
return {
|
|
|
state: {
|
|
|
home: {},
|
|
|
slider: {},
|
|
|
slider: [],
|
|
|
about: {},
|
|
|
gender: 'men',
|
|
|
men: {
|
...
|
...
|
@@ -50,6 +52,10 @@ export function createChannel() { |
|
|
state.home = result.data;
|
|
|
state.slider = slider.data[0].data;
|
|
|
},
|
|
|
[REFRESH_HOME_RESET](state) {
|
|
|
state.home = [];
|
|
|
state.slider = [];
|
|
|
},
|
|
|
[FETCH_ABOUT_REQUEST](state) {
|
|
|
state.fetchingAbout = true;
|
|
|
},
|
...
|
...
|
@@ -67,6 +73,10 @@ export function createChannel() { |
|
|
[FETCH_CHANNEL_FAILURE](state) {
|
|
|
state[state.gender].isFetching = false;
|
|
|
},
|
|
|
[REFRESH_CHANNEL_RESET](state) {
|
|
|
state[state.gender].floors = [];
|
|
|
state[state.gender].sort = [];
|
|
|
},
|
|
|
[FETCH_CHANNEL_SUCCESS](state, {data, sort, cache}) {
|
|
|
if (!cache) {
|
|
|
const keyCvt = {
|
...
|
...
|
@@ -96,6 +106,10 @@ export function createChannel() { |
|
|
}
|
|
|
|
|
|
commit(FETCH_HOME_REQUEST);
|
|
|
|
|
|
if (refresh) {
|
|
|
commit(REFRESH_HOME_RESET);
|
|
|
}
|
|
|
try {
|
|
|
const getContent = this.$api.get('/api/resource/get', {
|
|
|
home_invalid_cache: Date.now(),
|
...
|
...
|
@@ -121,6 +135,10 @@ export function createChannel() { |
|
|
commit(FETCH_CHANNEL_SUCCESS, {cache: true});
|
|
|
return Promise.resolve();
|
|
|
}
|
|
|
|
|
|
if (refresh) {
|
|
|
commit(REFRESH_CHANNEL_RESET);
|
|
|
}
|
|
|
try {
|
|
|
let getSort = this.$api.get('/sort/list', {
|
|
|
home_invalid_cache: Date.now(),
|
...
|
...
|
|