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

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

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

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

    })
    }

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