From 86b5d72e5d3a93142b7f7651797352ce86c4b8d3 Mon Sep 17 00:00:00 2001 From: Yixiang Zhao Date: Sun, 20 Mar 2022 11:54:14 +0800 Subject: [PATCH] fix: concatChar assignment logic (#595) Signed-off-by: Yixiang Zhao --- web/src/auth/AuthCallback.js | 2 +- web/src/auth/LoginPage.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/web/src/auth/AuthCallback.js b/web/src/auth/AuthCallback.js index 06e4e9811..2359c3afb 100644 --- a/web/src/auth/AuthCallback.js +++ b/web/src/auth/AuthCallback.js @@ -106,7 +106,7 @@ class AuthCallback extends React.Component { method: method, }; const oAuthParams = Util.getOAuthGetParameters(innerParams); - const concatChar = oAuthParams?.redirectUri?.indexOf('?') === -1 ? '?' : '&'; + const concatChar = oAuthParams?.redirectUri?.includes('?') ? '&' : '?'; AuthBackend.login(body, oAuthParams) .then((res) => { if (res.status === 'ok') { diff --git a/web/src/auth/LoginPage.js b/web/src/auth/LoginPage.js index cf9a9eabc..2f914041f 100644 --- a/web/src/auth/LoginPage.js +++ b/web/src/auth/LoginPage.js @@ -138,7 +138,7 @@ class LoginPage extends React.Component { Setting.goToLink(link); } else if (responseType === "code") { const code = res.data; - const concatChar = oAuthParams?.redirectUri?.indexOf('?') === -1 ? '?' : '&'; + const concatChar = oAuthParams?.redirectUri?.includes('?') ? '&' : '?'; if (Setting.hasPromptPage(application)) { AuthBackend.getAccount("")