diff --git a/frontend/wendys-friends/src/app/component/list-owners/list-owners.component.html b/frontend/wendys-friends/src/app/component/list-owners/list-owners.component.html
index a210f6f..8322421 100644
--- a/frontend/wendys-friends/src/app/component/list-owners/list-owners.component.html
+++ b/frontend/wendys-friends/src/app/component/list-owners/list-owners.component.html
@@ -30,7 +30,7 @@
{{ owner.name }} |
-
+
|
diff --git a/frontend/wendys-friends/src/app/component/list-owners/list-owners.component.ts b/frontend/wendys-friends/src/app/component/list-owners/list-owners.component.ts
index 2cc2926..7a7f8bf 100644
--- a/frontend/wendys-friends/src/app/component/list-owners/list-owners.component.ts
+++ b/frontend/wendys-friends/src/app/component/list-owners/list-owners.component.ts
@@ -71,6 +71,19 @@ export class ListOwnersComponent implements OnInit {
);
}
+ public deleteOwner(id: number, name: string) {
+ if(confirm("Are you sure you want to delete " + name + ". This action is irreversible.")) {
+ this.ownerService.deleteOwner(id).subscribe(
+ (res) => {
+ console.log('Successfully deleted owner');
+ this.loadAllOwners();
+ }, (error) => {
+ this.defaultServiceErrorHandling(error);
+ }
+ );
+ }
+ }
+
private defaultServiceErrorHandling(error: any) {
console.log(error);
this.error = true;
diff --git a/frontend/wendys-friends/src/app/service/owner.service.ts b/frontend/wendys-friends/src/app/service/owner.service.ts
index 08091ec..67811db 100644
--- a/frontend/wendys-friends/src/app/service/owner.service.ts
+++ b/frontend/wendys-friends/src/app/service/owner.service.ts
@@ -57,4 +57,13 @@ export class OwnerService {
console.log('Update owner with id ' + owner.id + ': '+ JSON.stringify(owner));
return this.httpClient.put(this.messageBaseUri + '/' + owner.id, owner);
}
+
+ /**
+ * Delete an owner from the backend
+ * @param id
+ */
+ deleteOwner(id: number): Observable