Skip to content

Commit

Permalink
Ability to delete levels
Browse files Browse the repository at this point in the history
jvyden committed Oct 30, 2023
1 parent d03bb90 commit acf9f20
Showing 2 changed files with 9 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/app/api/api-client.service.ts
Original file line number Diff line number Diff line change
@@ -155,6 +155,13 @@ export class ApiClient {
});
}

public DeleteLevel(level: Level): void {
this.apiRequestCreator.makeRequest("DELETE", "levels/id/" + level.levelId)
.subscribe(_ => {
this.bannerService.pushWarning("Level Deleted", `${level.title} was successfully removed.`);
});
}

public AdminAddAnnouncement(title: string, body: string) {
this.makeRequest<Announcement>("POST", "admin/announcements", {title, text: body})
.subscribe(data => {
3 changes: 2 additions & 1 deletion src/app/pages/edit-level/edit-level.component.ts
Original file line number Diff line number Diff line change
@@ -68,7 +68,8 @@ export class EditLevelComponent implements OnInit{
}

delete() {

if(this.level == undefined) return;
this.apiClient.DeleteLevel(this.level)
}

protected readonly faCertificate = faCertificate;

0 comments on commit acf9f20

Please sign in to comment.