Skip to content

Commit

Permalink
Fix cancel button navigating to home page instead of meeting details
Browse files Browse the repository at this point in the history
  • Loading branch information
marcel2215 committed Feb 15, 2024
1 parent 031e7aa commit d23a272
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/Components/Pages/MeetingEdition.razor
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@
@if (_meeting.UserId != User.Id)
{
<div class="text-center">
<h1 class="text-2xl font-bold">Access Denied</h1>
<p>You do not have permission to edit this meeting.</p>
</div>
<h1 class="text-2xl font-bold">Access Denied</h1>
<p>You do not have permission to edit this meeting.</p>
</div>
return;
}

<div class="space-y-4">
<h1 class="text-4xl font-bold">Edit Meeting</h1>
<MeetingEditor Meeting="_meeting" />
<div class="flex space-x-4">
<NTButton Clicked="NavigateToHomePage">Cancel</NTButton>
<NTButton Clicked="NavigateToDetails">Cancel</NTButton>
<NTButton Style="ButtonStyle.Accent" Clicked="SaveChangesAsync">Save</NTButton>
</div>
</div>
Expand Down Expand Up @@ -52,9 +52,12 @@
}
}

private void NavigateToHomePage()
private void NavigateToDetails()
{
NavigationManager.NavigateTo("/");
if (_meeting != null)
{
NavigationManager.NavigateTo($"/m/{_meeting.Code}");
}
}

private async Task SaveChangesAsync()
Expand All @@ -67,7 +70,7 @@
}

await MeetingManager.UpdateAsync(_meeting);
NavigationManager.NavigateTo($"/m/{_meeting.Code}");
NavigateToDetails();
}
}
}

0 comments on commit d23a272

Please sign in to comment.