|
|
@ -1,7 +1,7 @@ |
|
|
import { Reducer } from 'redux'; |
|
|
import { Reducer } from 'redux'; |
|
|
import { routerRedux } from 'dva/router'; |
|
|
|
|
|
import { Effect } from 'dva'; |
|
|
import { Effect } from 'dva'; |
|
|
import { stringify } from 'querystring'; |
|
|
import { stringify } from 'querystring'; |
|
|
|
|
|
import router from 'umi/router'; |
|
|
|
|
|
|
|
|
import { fakeAccountLogin, getFakeCaptcha } from '@/services/login'; |
|
|
import { fakeAccountLogin, getFakeCaptcha } from '@/services/login'; |
|
|
import { setAuthority } from '@/utils/authority'; |
|
|
import { setAuthority } from '@/utils/authority'; |
|
|
@ -57,25 +57,24 @@ const Model: LoginModelType = { |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
yield put(routerRedux.replace(redirect || '/')); |
|
|
router.replace(redirect || '/'); |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
*getCaptcha({ payload }, { call }) { |
|
|
*getCaptcha({ payload }, { call }) { |
|
|
yield call(getFakeCaptcha, payload); |
|
|
yield call(getFakeCaptcha, payload); |
|
|
}, |
|
|
}, |
|
|
*logout(_, { put }) { |
|
|
|
|
|
|
|
|
logout() { |
|
|
const { redirect } = getPageQuery(); |
|
|
const { redirect } = getPageQuery(); |
|
|
// redirect
|
|
|
// Note: There may be security issues, please note
|
|
|
if (window.location.pathname !== '/user/login' && !redirect) { |
|
|
if (window.location.pathname !== '/user/login' && !redirect) { |
|
|
yield put( |
|
|
router.replace({ |
|
|
routerRedux.replace({ |
|
|
pathname: '/user/login', |
|
|
pathname: '/user/login', |
|
|
search: stringify({ |
|
|
search: stringify({ |
|
|
redirect: window.location.href, |
|
|
redirect: window.location.href, |
|
|
|
|
|
}), |
|
|
|
|
|
}), |
|
|
}), |
|
|
); |
|
|
}); |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
|