修正了weChatLoginGrant对state为空的处理逻辑
This commit is contained in:
parent
9e6922e468
commit
421a168efc
|
|
@ -20,6 +20,7 @@ function Grant(props) {
|
|||
}, [appId]);
|
||||
const prefixCls = 'oak';
|
||||
const prefixCls2 = `${prefixCls}-loginGrant`;
|
||||
const { pathname, search } = window.location;
|
||||
let V;
|
||||
if (dev) {
|
||||
V = (<div className={`${prefixCls2}_dev`}>
|
||||
|
|
@ -38,7 +39,7 @@ function Grant(props) {
|
|||
const url = new URL(decodeURIComponent(redirectUri));
|
||||
url.searchParams.set('code', code);
|
||||
if (state) {
|
||||
url.searchParams.set('state', state || window.location.pathname);
|
||||
url.searchParams.set('state', state || pathname + search);
|
||||
}
|
||||
window.location.href = url.toString();
|
||||
setTimeout(() => {
|
||||
|
|
@ -69,7 +70,7 @@ function Grant(props) {
|
|||
return;
|
||||
}
|
||||
setDisabled2(true);
|
||||
const url = WeChatLoginUrl(redirectUri, appId, scope, `&state=${state || window.location.pathname}`);
|
||||
const url = WeChatLoginUrl(redirectUri, appId, scope, `&state=${state || pathname + search}`);
|
||||
window.location.href = url;
|
||||
setTimeout(() => {
|
||||
setDisabled2(false);
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ function Grant(props: GrantProps) {
|
|||
const prefixCls = 'oak';
|
||||
const prefixCls2 = `${prefixCls}-loginGrant`;
|
||||
|
||||
const { pathname, search } = window.location;
|
||||
let V;
|
||||
if (dev) {
|
||||
V = (
|
||||
|
|
@ -86,7 +87,7 @@ function Grant(props: GrantProps) {
|
|||
);
|
||||
url.searchParams.set('code', code);
|
||||
if (state) {
|
||||
url.searchParams.set('state', state || window.location.pathname);
|
||||
url.searchParams.set('state', state || pathname + search );
|
||||
}
|
||||
window.location.href = url.toString();
|
||||
|
||||
|
|
@ -130,7 +131,7 @@ function Grant(props: GrantProps) {
|
|||
redirectUri,
|
||||
appId,
|
||||
scope,
|
||||
`&state=${state || window.location.pathname}`,
|
||||
`&state=${state || pathname + search}`,
|
||||
);
|
||||
|
||||
window.location.href = url;
|
||||
|
|
|
|||
Loading…
Reference in New Issue