Commit f904467d authored by yoyo837's avatar yoyo837 Committed by 陈帅

登录使用replace,登出携带redirect for #1728

parent 0eaad1db
...@@ -31,28 +31,21 @@ export default { ...@@ -31,28 +31,21 @@ export default {
return; return;
} }
} }
yield put(routerRedux.push(redirect || '/')); yield put(routerRedux.replace(redirect || '/'));
} }
}, },
*logout(_, { put, select }) { *logout(_, { put }) {
try { yield put({
// get location pathname type: 'changeLoginStatus',
const urlParams = new URL(window.location.href); payload: {
const pathname = yield select(state => state.routing.location.pathname); status: false,
// add the parameters in the url currentAuthority: 'guest',
urlParams.searchParams.set('redirect', pathname); },
window.history.replaceState(null, 'login', urlParams.href); });
} finally { reloadAuthorized();
yield put({ yield put(
type: 'changeLoginStatus', routerRedux.push(`/user/login?redirect=${encodeURIComponent(window.location.href)}`)
payload: { );
status: false,
currentAuthority: 'guest',
},
});
reloadAuthorized();
yield put(routerRedux.push('/user/login'));
}
}, },
}, },
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment