action.js
728 Bytes
import * as Types from './types';
import { get } from 'lodash';
export default {
async fetchTopicList({ commit, state }, { page, limit }) {
if (state.fetchTopicList) {
return {};
}
page = page || state.fetchTopicPage || 1;
commit(Types.FETCH_NOTICE_LIST_REQUEST, { page });
const result = await this.$api.post('/api/grass/getGrassTopicList', {
page,
limit: limit || 10,
filter: 'Y',
lastedTime: state.fetchTopicLastedTime || void 0
});
if (result && result.code === 200) {
commit(Types.FETCH_NOTICE_LIST_SUCCESS, {
data: result.data,
page
});
} else {
commit(Types.FETCH_NOTICE_LIST_FAILD);
}
return result;
},
};