Skip to content

Commit

Permalink
Fix console errors
Browse files Browse the repository at this point in the history
  • Loading branch information
GregFinzer committed Aug 28, 2024
1 parent 076a31c commit d6f8471
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
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

0 comments on commit d6f8471

Please sign in to comment.