Merge branch 'main' into feature/ajouter
This commit is contained in:
commit
4d93763aa5
@ -23,7 +23,7 @@
|
||||
<!-- <td>{{products.Catégorie.}}</td> -->
|
||||
<td>{{products.rating}}</td>
|
||||
<td><a class="bi-pencil-square" routerLink="../modifier"></a></td>
|
||||
<td class="bi-trash-fill" style="color: red; cursor: pointer;" (click)="onClickDelete(5)"></td>
|
||||
<td class="bi-trash-fill" style="color: red; cursor: pointer;" (click)="onClickDelete(products.id)"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -28,8 +28,11 @@ export class PageTableauComponent implements OnInit {
|
||||
// })
|
||||
}
|
||||
|
||||
onClickDelete(id: number){
|
||||
onClickDelete(id: any){
|
||||
console.log(id);
|
||||
this.adminService.onClickDelete(id).subscribe((resp) => {
|
||||
console.log("Suppression successful : ", resp);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { map, Observable, Subject } from 'rxjs';
|
||||
import { map, Observable, Subject, tap } from 'rxjs';
|
||||
import { environment } from 'src/environments/environment';
|
||||
import { Plant } from '../models/plant';
|
||||
|
||||
@ -40,6 +40,11 @@ export class AdminService {
|
||||
addPlant(plant: Plant): Observable<any> | void {
|
||||
return this.httpClient.post(`${this.apiUrl}`, plant);
|
||||
}
|
||||
onClickDelete(id: number): Observable<any> {
|
||||
return this.httpClient.delete<any>(`${this.apiUrl}/list_products/${id}`).pipe(
|
||||
tap(() => this.refreshCollection())
|
||||
);
|
||||
}
|
||||
// getData(): Observable<any[]> {
|
||||
// return this.httpClient.get<any[]>(`${this.apiUrl}/list_products`);
|
||||
// }
|
||||
|
Loading…
Reference in New Issue
Block a user