Skip to content
This repository has been archived by the owner on Oct 31, 2022. It is now read-only.

Commit

Permalink
add button to leave wse, implements frontend part of #158
Browse files Browse the repository at this point in the history
  • Loading branch information
JohHub committed Oct 7, 2022
1 parent ee9f5f4 commit d2d5409
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion Frontend/Pages/WSE/WseDetail.razor
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
</div>
<div class="d-flex justify-content-between card-subtitle text-muted">
<h5 class="mb-2 me-2 text-muted">
@_contactPerson!.FirstNames @_contactPerson.LastName
@_contactPerson!.FirstNames @_contactPerson.LastName
<CollabModal WseId="WseId" WseContactPersonId="_wse.ContactPersonId"></CollabModal>
</h5>
Aufrufzahl: @_wse.ViewCount
Expand Down Expand Up @@ -248,6 +248,9 @@
@if (_isCollab) {
@if (!_displayEditForm) {
<div class="d-grid gap-2 mt-4 mb-4 d-flex justify-content-end">
<button class="btn btn-warning me-3" type="button" @onclick="Leave">
WSE verlassen
</button>
<button class="btn btn-success" type="button" @onclick="() => _displayEditForm = !_displayEditForm">
Bearbeiten
</button>
Expand Down Expand Up @@ -425,4 +428,13 @@
NavManager.NavigateTo("wse/" + WseId);
}

private async Task Leave() {
var response = await HttpClient.PostAsync($"wse/{WseId}/leave", null);
if (response.IsSuccessStatusCode) {
NavManager.NavigateTo("");
} else {
_conflictMessage = await response.Content.ReadAsStringAsync();
}
}

}

0 comments on commit d2d5409

Please sign in to comment.