modification messageService

This commit is contained in:
MiharyR 2021-12-04 11:09:37 +01:00
parent 819d266601
commit 6444df567b
4 changed files with 56 additions and 30 deletions

View file

@ -3,16 +3,38 @@ import {HttpClient} from "@angular/common/http";
import {environment} from "../../../../environments/environment";
import {Observable} from "rxjs";
@Injectable({
providedIn: 'root'
})
export class MessageService
{
constructor( private http: HttpClient ) { }
sendMessage( url, data ): Observable<any>
post(url: string, data: any): Observable<any>
{
const urlComplete = environment.debutUrl + url ;
return this.http.post<any>( urlComplete, data, {withCredentials: true} );
return this.http.post<any>(urlComplete, data, {withCredentials: true});
}
get(url: string, data: any): Observable<any>
{
const urlComplete = environment.debutUrl + url ;
return this.http.get<any>(urlComplete, data);
}
put(url: string, data: any): Observable<any>
{
const urlComplete = environment.debutUrl + url ;
return this.http.put<any>(urlComplete, data, {withCredentials: true});
}
delete(url: string, data: any): Observable<any>
{
const urlComplete = environment.debutUrl + url ;
return this.http.delete<any>(urlComplete, data);
}
}