import {Injectable} from "@angular/core"; import {Campaign} from "../../models/model-interfaces"; import {AppConfig} from "../../app.config"; import {HttpClient} from "../http-client"; @Injectable() export class CampaignService { campaigns: Campaign[]; constructor(private http: HttpClient, private config: AppConfig) { } getAllCampaigns() { return this.http.get(this.config.apiWarPath) .map(res => res.json()) } submitCampaign(campaign: Campaign) { return this.http.post(this.config.apiCampaignPath, campaign) .map(res => res.json()) } deleteCampaign(id: string) { return this.http.delete(this.config.apiCampaignPath + '/' + id) .map(res => res.json()) } }