import {Injectable} from '@angular/core';
import {HttpClient} from '@angular/common/http';
import { environment } from '../../environments/environment';
import {Observable} from "rxjs";
import {Router} from "@angular/router";

@Injectable({providedIn: 'root'})
export class FormsService {
  constructor(private http: HttpClient, private router: Router) {
  }

  save(target: string, type: string, id?: string, data?: any): Observable<any> {
    let url = `${environment.apiUrl}/api/forms/${target}/${type}`;
    return this.http.post(url,data);
  }
}
