text: import { routerRedux } from 'dva/router';
  import { message } from 'antd';
  import { fakeAccountLogin } from '../services/api';
  
  export default {
    namespace: 'login',
  
    state: {
      status: undefined,
    },
  
    effects: {
      *submit({ payload }, { call, put }) {
        const response = yield call(fakeAccountLogin, payload);
        // Login successfully
        if (response.code === 0) {
          yield put({
            type: 'changeLoginStatus',
            payload: {
              status: true,
            },
          });
          message.success('登录成功！');
          // yiled put(routerRedux.push('/'));
          location.href = '#/';
        } else {
          yield put({
            type: 'changeLoginStatus',
            payload: {
              status: false,
            },
          });
        }
      },
      *logout(_, { put }) {
          yield put(routerRedux.push('/user/login'));
      },
    },
  
    reducers: {
      changeLoginStatus(state, { payload }) {
        // setAuthority(payload.currentAuthority);
        return {
          ...state,
          status: payload.status,
          type: payload.type,
        };
      },
    },
  };
  