From 45400c86e2e5a1990468513d38fbee429bd6da4c Mon Sep 17 00:00:00 2001 From: liuxingyun Date: Fri, 20 Aug 2021 12:01:28 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20miniprogram=20authlogin?= =?UTF-8?q?=20add=20redirecturl=20param?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/token.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/token.ts b/lib/token.ts index 45509be..6d0c026 100644 --- a/lib/token.ts +++ b/lib/token.ts @@ -79,7 +79,7 @@ const initToken = async (ignore?: () => boolean) => { at.user.getToken().then(t => { if (t) { setToken(t); - resolve(); + resolve(void 0); } else { clearToken(); reject(new Error('token is empty')); @@ -93,7 +93,7 @@ const initToken = async (ignore?: () => boolean) => { if (token && String(token).length > 20) { setToken(token); - resolve(); + resolve(void 0); } else { clearToken(); reject(new Error('token is empty')); @@ -111,6 +111,7 @@ interface ItoLogin { success?: () => void; cancel?: () => void; isBind?: boolean; + redirectUrl?: string; } const toLogin = (appParams?: ItoLogin) => { @@ -127,7 +128,7 @@ const toLogin = (appParams?: ItoLogin) => { } }); } else if (window.isMiniProgram) { - Mini.authLogin(); + Mini.authLogin(appParams && appParams.redirectUrl); } else { window.location.href = `/m/login/?${qs.stringify({ redirect: window.location.href,