login中的一些问题

This commit is contained in:
Xu Chang 2022-06-22 13:48:37 +08:00
parent d895f05b15
commit 2ec21ba4ad
4 changed files with 6 additions and 4 deletions

View File

@ -89,7 +89,9 @@ export async function loginWechatMp<ED extends EntityDict, Cxt extends GeneralRu
entity: 'wechatUser', entity: 'wechatUser',
entityId: wechatUser2.id, entityId: wechatUser2.id,
}, },
}, context); }, context, {
omitTrigger: true,
});
if (token && isEqual(token.env, env)) { if (token && isEqual(token.env, env)) {
await rowStore.operate('token', { await rowStore.operate('token', {
action: 'update', action: 'update',

View File

@ -38,7 +38,7 @@ export class Token<ED extends EntityDict, Cxt extends GeneralRuntimeContext<ED>,
} }
@Action @Action
async loginWechatMp(scene: string) { async loginWechatMp() {
await this.rwLock.acquire('X'); await this.rwLock.acquire('X');
try { try {
const { code } = await wx.login(); const { code } = await wx.login();

View File

@ -28,7 +28,7 @@ OakPage({
async onLoginClicked(options: WechatMiniprogram.Touch) { async onLoginClicked(options: WechatMiniprogram.Touch) {
const { code } = await wx.login(); const { code } = await wx.login();
const env = await wx.getSystemInfo(); const env = await wx.getSystemInfo();
await this.features.token.loginWechatMp('token:login'); await this.features.token.loginWechatMp();
}, },
onReturnClicked() { onReturnClicked() {

View File

@ -101,7 +101,7 @@ OakPage(
refreshing: true, refreshing: true,
}); });
try { try {
await this.features.token.loginWechatMp('token:me'); await this.features.token.loginWechatMp();
} catch (err) { } catch (err) {
console.error(err); console.error(err);
} }