we_bstly-web/src/app/services/item.service.ts

31 lines
739 B
TypeScript
Raw Normal View History

2020-11-02 08:29:52 +01:00
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { environment } from '../../environments/environment';
@Injectable({
providedIn: 'root',
})
export class ItemService {
constructor(private http: HttpClient) {
}
items() {
return this.http.get(environment.apiUrl + "/items");
}
redeemSecret(secret) {
return this.http.put(environment.apiUrl + "/items", JSON.stringify(secret));
}
removeSecret(secret: String) {
return this.http.request('delete', environment.apiUrl + "/items", {
body: JSON.stringify(secret)
});
}
redeem() {
return this.http.post(environment.apiUrl + "/items", {});
}
}