organizee-front/src/app/services/todo.service.ts
2022-02-16 15:32:19 +01:00

31 lines
929 B
TypeScript

import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { environment } from 'src/environments/environment';
import { Tache } from '../models/tache';
import { ToDoList } from '../models/to-do-list';
@Injectable({
providedIn: 'root',
})
export class TodoService {
private toDoList: any;
private apiUrl: string;
constructor(private http: HttpClient) {
this.apiUrl = environment.apiUrl;
}
getToDoListByTeamId(): Observable<any> {
return this.http.get(`${this.apiUrl}/todolist/team/1`);
}
deleteTacheById(idTache: any): Observable<any> {
return this.http.delete(`${this.apiUrl}/taches/delete/${idTache}`,{responseType:'text'});
}
addTache(newtache: Tache,idTodoList:number): Observable<any> {
console.log(newtache +'gkggg');
return this.http.post(`${this.apiUrl}/taches/add/${idTodoList}`, newtache);
}
}