24 lines
616 B
TypeScript
24 lines
616 B
TypeScript
import { Service } from '@angular/core';
|
|
import { BaseService } from './base.service';
|
|
import { Observable } from 'rxjs';
|
|
import { Group } from '../model/Group';
|
|
@Service()
|
|
export class GroupService extends BaseService {
|
|
public getGroups(): Observable<Group[]> {
|
|
return this.get<Group[]>("group");
|
|
}
|
|
|
|
public addGroup(name: string): Observable<Group> {
|
|
let body: Group = {
|
|
id_group: 0,
|
|
name_group: name,
|
|
};
|
|
|
|
return this.post<Group>("group/add", body);
|
|
}
|
|
|
|
public deleteGroup(id_group: number): Observable<void> {
|
|
return this.delete<void>(`group/delete?id=${id_group}`);
|
|
}
|
|
}
|