Skip to content

Commit 4c1d230

Browse files
committed
Fix .NET sample app
1 parent 9e9678e commit 4c1d230

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

complete/dotnet/Contoso.BlazorApp/Components/Pages/Home.razor

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@
6868
}
6969
}
7070

71-
private async Task HandleAuthStateChanged()
71+
private void HandleAuthStateChanged()
7272
{
73-
await InvokeAsync(async () =>
73+
InvokeAsync(async () =>
7474
{
7575
if (!AuthService.AuthState.IsLoading && !AuthService.AuthState.IsAuthenticated)
7676
{

complete/dotnet/Contoso.BlazorApp/Services/ApiService.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,12 @@ private string GetApiBaseUrl(string configuredBaseUrl)
4646
_logger.LogInformation("Using GitHub Codespaces URL: {CodespacesUrl}", codespacesUrl);
4747
return codespacesUrl;
4848
}
49-
49+
5050
// Fall back to configured base URL (localhost)
51-
_logger.LogInformation("Using configured base URL: {ConfiguredUrl}", configuredBaseUrl);
52-
return configuredBaseUrl;
51+
// Ensure the URL ends with a forward slash for proper relative path resolution
52+
var normalizedUrl = configuredBaseUrl.TrimEnd('/') + "/";
53+
_logger.LogInformation("Using configured base URL: {ConfiguredUrl}", normalizedUrl);
54+
return normalizedUrl;
5355
}
5456

5557
private void SetAuthHeaders()

0 commit comments

Comments
 (0)