mirror of https://github.com/chillzhuang/Sword
29 lines
510 B
JavaScript
29 lines
510 B
JavaScript
import { queryProjectNotice } from '../services/notice';
|
|
|
|
export default {
|
|
namespace: 'project',
|
|
|
|
state: {
|
|
notice: [],
|
|
},
|
|
|
|
effects: {
|
|
*fetchNotice(_, { call, put }) {
|
|
const response = yield call(queryProjectNotice);
|
|
yield put({
|
|
type: 'saveNotice',
|
|
payload: Array.isArray(response.data) ? response.data : [],
|
|
});
|
|
},
|
|
},
|
|
|
|
reducers: {
|
|
saveNotice(state, action) {
|
|
return {
|
|
...state,
|
|
notice: action.payload,
|
|
};
|
|
},
|
|
},
|
|
};
|