actions.js
768 Bytes
import * as Types from './types'
import { get } from 'lodash';
export default {
async fetchNoticeList({ commit, state }) {
if (state.fetchNoticeList) {
return {};
}
let page = state.fetchNoticePage || 1;
commit(Types.FETCH_NOTICE_LIST_REQUEST, { page });
const result = await this.$api.post('/api/ufo/home/noticelist', {
page,
size: 20,
lastedTime: state.fetchNoticeLastedTime || 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;
},
}