Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix console errors #333

Merged
merged 1 commit into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions BedBrigade.Client/Components/Pages/Index.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,22 @@ protected override async Task OnParametersSetAsync()
{
string location = string.IsNullOrEmpty(mylocation) ? defaultLocation : mylocation;
string pageName = string.IsNullOrEmpty(mypageName) ? defaultPageName : mypageName;
_locationState.Location = location;


if (previousLocation.ToLower() != location.ToLower() || previousPageName.ToLower() != pageName.ToLower())
{
previousLocation = location;
previousPageName = pageName;
await LoadLocationPage(location, pageName);
bool loaded= await LoadLocationPage(location, pageName);

if (loaded)
{
_locationState.Location = location;
}
}
}

private async Task LoadLocationPage(string location, string pageName)
private async Task<bool> LoadLocationPage(string location, string pageName)
{
Log.Logger.Debug("Index.LoadLocationPage");

Expand All @@ -73,18 +78,22 @@ private async Task LoadLocationPage(string location, string pageName)
else
{
_navigationManager.NavigateTo("/Sorry", true);
return false;
}
}
else
{
_navigationManager.NavigateTo("/Sorry", true);
return false;
}
}
catch (Exception ex)
{
Log.Logger.Error(ex, $"LoadLocationPage: {ex.Message}");
throw;
}

return true;
}
}
}
5 changes: 2 additions & 3 deletions BedBrigade.Client/Components/Pages/Sorry.razor
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
@page "/sorry"
<PageTitle>Sorry</PageTitle>
<h3 class="text-center my-6">Sorry - the page associated with this link was not found. </h3>
<h3 class="text-center mt-5">Sorry - the page associated with this link was not found. </h3>

@code {
//TODO: Add notification codes.
// Add notification codes.
//TODO: Add notification code.
}
4 changes: 2 additions & 2 deletions BedBrigade.Client/Components/SearchLocation.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ private bool ValidatePostalCode()
if (!Regex.IsMatch(PostalCode, @"\d{5}$"))
{
strAlertType = "alert alert-danger";
PostalCodeResult = "Error! Zip code must be numeric and have a length of 5.";
PostalCodeResult = "Zip code must be numeric and have a length of 5.";
return false;
}

Expand Down Expand Up @@ -154,7 +154,7 @@ private async Task HandleSearchClick()
if (!Result.Success || Result.Data == null)
{
strAlertType = AlertDanger;
PostalCodeResult = "Error! " + Result.Message;
PostalCodeResult = Result.Message;
Locations = new List<LocationDistance>(); // empty location list
await SetZipBoxFocus();
return;
Expand Down
Loading