'get current id of tenant - thingsboard platform

I'm trying to get the ID of the current tenant in thingthboard

I tried to look in their code where it is stored but I can not find

Anyone know?



Solution 1:[1]

I searched deep in the thingsboard code and finally found it:

  initCurrentTenantId() {
    this.store.pipe(select(selectAuthUser), take(1)).pipe(
      tap((authUser) => {
        if (authUser.authority === Authority.TENANT_ADMIN) {
          this.CurrentTenantId = authUser.tenantId;        }
      })
    ).subscribe(res => {
      console.log('**************userrrrrr:', res);
      this.CurrentTenantId = res.tenantId;
    });
  }

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Neomi