import { Component, OnInit } from '@angular/core';
import {RestaurantesService} from "../../restaurantes.service";
import {AuthService} from "@auth0/auth0-angular";
import {HttpClient} from "@angular/common/http";
import {concatMap, tap} from "rxjs/operators";

@Component({
  selector: 'app-sectores',
  templateUrl: './sectores.component.html',
  styleUrls: ['./sectores.component.scss']
})
export class SectoresComponent implements OnInit {

  Sectores:any;
  idSelect:any;
  NombreSelect:any;
  dato: any;
  usuarios:any;
  otro:any;

  constructor(public auth: AuthService, private  http: HttpClient, private restaurantServ : RestaurantesService) { }

  ngOnInit(): void {
    this.auth.user$
      .pipe(

        concatMap((user)=>
          this.http.get(`https://api.unified.restaurant/api/v1/users/${user?.sub}/restaurantes`)
        ),
        tap((userdato) =>(this.dato = userdato))
      ).subscribe()

    console.log();


  }


}
