import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; @Injectable({ providedIn: 'root' }) export class ApiService { server_route = 'http://localhost:3000' constructor(private http: HttpClient) { } getMessage() { return this.http.get( 'http://localhost:3000/api/message'); } postReplayUpload(file: any) { return this.http.post( this.server_route+'/api/upload-replay', file); } getSeasons() { return this.http.get( this.server_route+'/api/seasons'); } getSeasonDetails(id: number) { return this.http.get( this.server_route+'/api/seasons/'+id); } addSeason(title: string, subtitle: string, startDate: Date) { console.log("hullo"); return this.http.post<{title: string, subtitle: string, startDate: Date}>(this.server_route+'/api/seasons/add', { title, subtitle, startDate }, {headers: { authorization: `Bearer ${localStorage.getItem('token')}` },}); } }