31 lines
739 B
TypeScript
31 lines
739 B
TypeScript
|
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", {});
|
||
|
}
|
||
|
}
|