Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { Injectable } from '@angular/core';
- import {HttpClient} from "@angular/common/http";
- import {Observable} from "rxjs";
- import {ConfigService} from '../../services/config.service';
- @Injectable({
- providedIn: 'root'
- })
- export class HttpCarsService {
- constructor(private httpService:HttpClient, private configService: ConfigService) { }
- private _car_url = this.configService._api_url +'/cars';
- private _car1_url = this.configService._api_url +'/cars?id=';
- public getCarList(): Observable<any> {
- return this.httpService.get(this._car_url +'/all');
- }
- public createCar(car: object): Observable<object> {
- return this.httpService.post(this._car_url, car);
- }
- public deleteCar(id: number): Observable<object> {
- return this.httpService.delete(this._car1_url + id);
- }
- public getCar(id: number): Observable<object> {
- return this.httpService.get(this._car1_url + id);
- }
- updateCar(id: number, value: any): Observable<object> {
- return this.httpService.put(this._car1_url + id, value);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment