import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { TypeRoom } from '../models/typeroom.model';

@Injectable({ providedIn: 'root' })
export class TypeRoomService {
    // addType(modelType: Function) {
    //   throw new Error('Method not implemented.');
    // }

    constructor(private http: HttpClient) { }
    url: string = "http://0eb9-110-169-220-190.ngrok.io";
    listType: TypeRoom[] = []

    addTypeRoom(model: TypeRoom) {
        console.log("type", model)
    this.http.post(this.url + "/typeroom/", model).subscribe(response => {
      console.log(response);

    })
    }

    getListTypeRoom(): Observable<TypeRoom[]> {
        return this.http.get<TypeRoom[]>(this.url + "/typeroom/lists");
    }
}
