28 lines
767 B
TypeScript
28 lines
767 B
TypeScript
|
import {Injectable} from "@angular/core";
|
||
|
import {AppConfig} from "../../app.config";
|
||
|
import {HttpClient} from "../http-client";
|
||
|
import {Promotion} from "../../models/model-interfaces";
|
||
|
|
||
|
@Injectable()
|
||
|
export class PromotionService {
|
||
|
|
||
|
constructor(private http: HttpClient,
|
||
|
private config: AppConfig) {
|
||
|
}
|
||
|
|
||
|
getSquadPromotions(squadId: string) {
|
||
|
return this.http.get(this.config.apiUrl + this.config.apiPromotionPath + '?squadId=' + squadId)
|
||
|
.map(res => res.json())
|
||
|
}
|
||
|
|
||
|
requestPromotion(promotion: Promotion) {
|
||
|
return this.http.post(this.config.apiUrl + this.config.apiPromotionPath, promotion)
|
||
|
}
|
||
|
|
||
|
deletePromotion(promotionId) {
|
||
|
return this.http.delete(this.config.apiUrl + this.config.apiPromotionPath + promotionId)
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|