import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { environment } from 'src/environments/environment';

@Injectable({
  providedIn: 'root'
})
export class UserService {

constructor(
  private readonly http: HttpClient,
) { }

getUsers() {
  let url = environment.url + `auth/users`;
    return this.http.get<any[]>(url);
}

getPermissionUser(id: number) {
  let url = environment.url + `access-control/permissionUser/${id}`;
    return this.http.get<any[]>(url);
}

updatePermissionUser(id: number, data: any) {
  console.log('Executando updatePermissionUser');
  let url = environment.url + `access-control/permissionUser/${id}`;
  const response = this.http.post(url, data).subscribe();
  return response;
}

}
