You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
964 B

2 years ago
import { Injectable } from '@angular/core';
import { HttpClient } from "@angular/common/http";
import { Observable, from } from "rxjs";
import { Race } from '../models/race.model';
@Injectable({
providedIn: 'root'
})
export class RacesService {
constructor(private httpClient: HttpClient) {
}
getAllRaces(): Observable<Array<Race>> {
return this.httpClient.get<Array<Race>>("assets/races.json");
}
getRace(id: string) {
return this.httpClient.get("http://localhost:3000/races/"+id);
}
getRaceResults(id: string) {
return this.httpClient.get("http://localhost:3000/races/"+id+"/results");
2 years ago
}
getMapInfo(mapUID: string) {
return this.httpClient.get("http://localhost:3000/races/map/"+mapUID);
}
create(mapUID: string, startDate: Date, endDate: Date, seasonId: number) {
return this.httpClient.post("http://localhost:3000/races", { mapUID: mapUID, startDate: startDate, endDate: endDate, seasonId: seasonId});
}
2 years ago
}