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.
34 lines
980 B
34 lines
980 B
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://172.16.40.146:3000/races/"+id);
|
|
}
|
|
|
|
getRaceResults(id: string) {
|
|
return this.httpClient.get("http://172.16.40.146:3000/races/"+id+"/results");
|
|
}
|
|
|
|
getMapInfo(mapUID: string) {
|
|
return this.httpClient.get("http://172.16.40.146:3000/races/map/"+mapUID);
|
|
}
|
|
|
|
create(mapUID: string, startDate: Date, endDate: Date, seasonId: number) {
|
|
return this.httpClient.post("http://172.16.40.146:3000/races", { mapUID: mapUID, startDate: startDate, endDate: endDate, seasonId: seasonId});
|
|
}
|
|
}
|
|
|