fix;合并修复问题
This commit is contained in:
@@ -41,6 +41,19 @@ export function handlePartnerWechatLoginResult(result: WechatLoginResult): boole
|
||||
return true;
|
||||
}
|
||||
|
||||
/** 微信登录成功后拉取并缓存合伙人资料,供一键登录页展示 */
|
||||
export async function persistPartnerProfileAfterLogin(): Promise<void> {
|
||||
try {
|
||||
const profile = await fetchPartnerProfile();
|
||||
saveAuth({
|
||||
accessToken: localStorage.getItem('accessToken') ?? '',
|
||||
partner: profile,
|
||||
});
|
||||
} catch {
|
||||
/* ignore */
|
||||
}
|
||||
}
|
||||
|
||||
export async function handlePartnerWechatCallback(): Promise<WechatLoginResult | null> {
|
||||
if (!isWechatEnv()) return null;
|
||||
const config = await fetchClientConfig();
|
||||
@@ -62,16 +75,6 @@ export async function loginPartnerWithWechat(): Promise<boolean | void> {
|
||||
if (result) return handlePartnerWechatLoginResult(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 短信登录成功后于微信内自动发起 OAuth,将 openId 绑定到当前合伙人账号(便于同一微信后续免登)。
|
||||
*/
|
||||
export async function bindPartnerWechatAfterSmsLogin(): Promise<void> {
|
||||
const config = await fetchClientConfig();
|
||||
if (!isWxAuthorizeEnabled(config)) return;
|
||||
if (!isWechatEnv()) return;
|
||||
await weixinSdk.login();
|
||||
}
|
||||
|
||||
export async function authorizePartnerWechat(): Promise<WechatLoginResult | void> {
|
||||
const config = await fetchClientConfig();
|
||||
if (!isWxAuthorizeEnabled(config)) return;
|
||||
|
||||
Reference in New Issue
Block a user