动态菜单和动态路由的 antd pro

123456789101112131415161718192021222324252627282930313233343536373839
  1. import { queryBasicProfile, queryAdvancedProfile } from '../services/api';
  2. export default {
  3. namespace: 'profile',
  4. state: {
  5. basicGoods: [],
  6. advancedOperation1: [],
  7. advancedOperation2: [],
  8. advancedOperation3: [],
  9. },
  10. effects: {
  11. *fetchBasic(_, { call, put }) {
  12. const response = yield call(queryBasicProfile);
  13. yield put({
  14. type: 'show',
  15. payload: response,
  16. });
  17. },
  18. *fetchAdvanced(_, { call, put }) {
  19. const response = yield call(queryAdvancedProfile);
  20. yield put({
  21. type: 'show',
  22. payload: response,
  23. });
  24. },
  25. },
  26. reducers: {
  27. show(state, { payload }) {
  28. return {
  29. ...state,
  30. ...payload,
  31. };
  32. },
  33. },
  34. };