尝试更新了wechatPublic登录的state为空问题
This commit is contained in:
parent
fd3104d7e0
commit
9e6922e468
|
|
@ -38,7 +38,7 @@ function Grant(props) {
|
||||||
const url = new URL(decodeURIComponent(redirectUri));
|
const url = new URL(decodeURIComponent(redirectUri));
|
||||||
url.searchParams.set('code', code);
|
url.searchParams.set('code', code);
|
||||||
if (state) {
|
if (state) {
|
||||||
url.searchParams.set('state', state);
|
url.searchParams.set('state', state || window.location.pathname);
|
||||||
}
|
}
|
||||||
window.location.href = url.toString();
|
window.location.href = url.toString();
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
|
@ -69,7 +69,7 @@ function Grant(props) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setDisabled2(true);
|
setDisabled2(true);
|
||||||
const url = WeChatLoginUrl(redirectUri, appId, scope, state ? `&state=${state}` : '');
|
const url = WeChatLoginUrl(redirectUri, appId, scope, `&state=${state || window.location.pathname}`);
|
||||||
window.location.href = url;
|
window.location.href = url;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
setDisabled2(false);
|
setDisabled2(false);
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ function Grant(props: GrantProps) {
|
||||||
);
|
);
|
||||||
url.searchParams.set('code', code);
|
url.searchParams.set('code', code);
|
||||||
if (state) {
|
if (state) {
|
||||||
url.searchParams.set('state', state);
|
url.searchParams.set('state', state || window.location.pathname);
|
||||||
}
|
}
|
||||||
window.location.href = url.toString();
|
window.location.href = url.toString();
|
||||||
|
|
||||||
|
|
@ -130,7 +130,7 @@ function Grant(props: GrantProps) {
|
||||||
redirectUri,
|
redirectUri,
|
||||||
appId,
|
appId,
|
||||||
scope,
|
scope,
|
||||||
state ? `&state=${state}` : ''
|
`&state=${state || window.location.pathname}`,
|
||||||
);
|
);
|
||||||
|
|
||||||
window.location.href = url;
|
window.location.href = url;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue