fix: me switch me bugs

This commit is contained in:
2024-11-03 01:48:20 +08:00
parent 6021aca4ba
commit 8bfa81842b
2 changed files with 20 additions and 6 deletions

View File

@@ -33,8 +33,8 @@ export class User extends Model {
}
/**
* uid 是用于 orgId 的用户id
* @param uid
* @returns
* @param uid
* @returns
*/
async createToken(uid?: string) {
const { id, username, type, supaId } = this;
@@ -113,6 +113,9 @@ export class User extends Model {
if (this.type === 'org') {
if (this.tokenUser && this.tokenUser.uid) {
id = this.tokenUser.uid;
} else {
console.log('getOrgs', 'no uid', this.id, this.username);
throw new CustomError('Permission denied');
}
}
const cache = await redis.get(`user:${id}:orgs`);