Skip to content
Snippets Groups Projects
Commit 3df3d139 authored by Lukas Mauß's avatar Lukas Mauß
Browse files

Add deleteComment function

parent 55078ede
Branches
Tags
No related merge requests found
......@@ -49,6 +49,9 @@
<button mat-icon-button (focus)="hideCommentsList=false" (click)="sortTimeStamp()">
<mat-icon color="primary">remove</mat-icon>
</button>
<button mat-icon-button *ngIf="userRole === 1" (focus)="hideCommentsList=false" (click)="deleteComments()">
<mat-icon color="primary">delete</mat-icon>
</button>
</div>
</mat-menu>
</div>
......
......@@ -200,4 +200,8 @@ export class CommentListComponent implements OnInit {
return +dateB - +dateA;
});
}
deleteComments(): void {
this.commentService.deleteCommentsByRoomId(this.roomId).subscribe();
}
}
......@@ -66,4 +66,12 @@ export class CommentService extends BaseHttpService {
catchError(this.handleError<any>('updateComment'))
);
}
deleteCommentsByRoomId(roomId: string): Observable<Comment> {
const connectionUrl = `${this.apiUrl.base + this.apiUrl.comment}/byRoom?roomId=${roomId}`;
return this.http.delete<Comment>(connectionUrl, httpOptions).pipe(
tap(_ => ''),
catchError(this.handleError<Comment>('deleteComment'))
);
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment