aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/app/_services/experiments.service.ts
blob: 0d0d372b323e83ae721e6fd0443ee1c2302566a9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { Configuration } from '../configuration.service';
import Experiment from '../_data/Experiment';
import { AuthService } from './auth.service';

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

  constructor(private http: HttpClient, private authService: AuthService) { }

  addExperiment(experiment: Experiment): Observable<any> {
    return this.http.post(`${Configuration.settings.apiURL}/experiment/add`, experiment, { headers: this.authService.authHeader() });
  }

  getMyExperiments(): Observable<Experiment[]> {
    return this.http.get<Experiment[]>(`${Configuration.settings.apiURL}/experiment/getmyexperiments`, { headers: this.authService.authHeader() });
  }
}