public selectTenant()

in sample/authui-react/src/components/app.tsx [133:159]


  public selectTenant(
      projectConfig: {projectId: string}, tenantIds: string[]): Promise<ciap.SelectedTenantInfo> {
    const topLevelProject = `_${projectConfig.projectId}`;
    const tenants: Array<{tenantId: string, tenantDisplayName: string}> = [];
    let charCode = 'A'.charCodeAt(0);
    tenantIds.forEach((tenantId) => {
      tenants.push({
        tenantId: tenantId || topLevelProject,
        tenantDisplayName: `Company ${String.fromCharCode(charCode)}`,
      });
      charCode++;
    });
    return new Promise((resolve, reject) => {
      this.renderSelectTenant(
          tenants,
          (selectedTenantId: string | null) => {
            this.updateError(null);
            if (selectedTenantId === topLevelProject) {
              selectedTenantId = null;
            }
            resolve({
              tenantId: selectedTenantId,
              providerIds: [],
            });
          });
    });
  }