瀏覽代碼

fix: update current tenant id of account when switching tenant (#2530)

Bowen Liang 1 年之前
父節點
當前提交
9ecc736c30
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      api/services/account_service.py

+ 1 - 1
api/services/account_service.py

@@ -282,9 +282,9 @@ class TenantService:
         else: 
             TenantAccountJoin.query.filter(TenantAccountJoin.account_id == account.id, TenantAccountJoin.tenant_id != tenant_id).update({'current': False})
             tenant_account_join.current = True
-            db.session.commit()
             # Set the current tenant for the account
             account.current_tenant_id = tenant_account_join.tenant_id
+            db.session.commit()
 
     @staticmethod
     def get_tenant_members(tenant: Tenant) -> list[Account]: