model.js
440 Bytes
import { queryTags } from './service';
export default {
namespace: 'BLOCK_NAME',
state: {
tags: [],
},
effects: {
*fetchTags(_, { call, put }) {
const response = yield call(queryTags);
yield put({
type: 'saveTags',
payload: response.list,
});
},
},
reducers: {
saveTags(state, action) {
return {
...state,
tags: action.payload,
};
},
},
};