39 lines
947 B
TypeScript
39 lines
947 B
TypeScript
import { Injectable } from '@angular/core';
|
|
import { HttpClient } from '@angular/common/http';
|
|
import { environment } from '../../environments/environment';
|
|
|
|
@Injectable({
|
|
providedIn: 'root',
|
|
})
|
|
export class VoteService {
|
|
|
|
constructor(private http: HttpClient) {
|
|
}
|
|
|
|
|
|
getEntryPoints(target: number) {
|
|
return this.http.get(environment.apiUrl + "/v/e/" + target);
|
|
}
|
|
|
|
voteEntryUp(id: number) {
|
|
return this.http.put(environment.apiUrl + "/v/e/" + id, {});
|
|
}
|
|
|
|
voteEntryDown(id: number) {
|
|
return this.http.delete(environment.apiUrl + "/v/e/" + id, {});
|
|
}
|
|
|
|
getCommentPoints(target: number) {
|
|
return this.http.get(environment.apiUrl + "/v/c/" + target);
|
|
}
|
|
|
|
voteCommentUp(id: number) {
|
|
return this.http.put(environment.apiUrl + "/v/c/" + id, {});
|
|
}
|
|
|
|
voteCommentDown(id: number) {
|
|
return this.http.delete(environment.apiUrl + "/v/c/" + id, {});
|
|
}
|
|
|
|
|
|
} |