mirror of
https://github.com/chillzhuang/Sword
synced 2024-09-21 04:04:12 +08:00
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,
|
||
|
};
|
||
|
},
|
||
|
},
|
||
|
};
|