|
|
@@ -31,28 +31,21 @@ export default {
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
- yield put(routerRedux.push(redirect || '/'));
|
|
|
+ yield put(routerRedux.replace(redirect || '/'));
|
|
|
}
|
|
|
},
|
|
|
- *logout(_, { put, select }) {
|
|
|
- try {
|
|
|
- // get location pathname
|
|
|
- const urlParams = new URL(window.location.href);
|
|
|
- const pathname = yield select(state => state.routing.location.pathname);
|
|
|
- // add the parameters in the url
|
|
|
- urlParams.searchParams.set('redirect', pathname);
|
|
|
- window.history.replaceState(null, 'login', urlParams.href);
|
|
|
- } finally {
|
|
|
- yield put({
|
|
|
- type: 'changeLoginStatus',
|
|
|
- payload: {
|
|
|
- status: false,
|
|
|
- currentAuthority: 'guest',
|
|
|
- },
|
|
|
- });
|
|
|
- reloadAuthorized();
|
|
|
- yield put(routerRedux.push('/user/login'));
|
|
|
- }
|
|
|
+ *logout(_, { put }) {
|
|
|
+ yield put({
|
|
|
+ type: 'changeLoginStatus',
|
|
|
+ payload: {
|
|
|
+ status: false,
|
|
|
+ currentAuthority: 'guest',
|
|
|
+ },
|
|
|
+ });
|
|
|
+ reloadAuthorized();
|
|
|
+ yield put(
|
|
|
+ routerRedux.push(`/user/login?redirect=${encodeURIComponent(window.location.href)}`)
|
|
|
+ );
|
|
|
},
|
|
|
},
|
|
|
|