Skip to content

Commit

Permalink
PAS-532-better-error-handling-auth-configs (#635)
Browse files Browse the repository at this point in the history
* Added try catch around getting auth configs and fixed url
  • Loading branch information
jrmccannon authored Jul 11, 2024
1 parent c77f827 commit b66156e
Showing 1 changed file with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
@inject NavigationManager NavigationManager;
@inject IHttpContextAccessor HttpContextAccessor;
@inject IScopedPasswordlessClient Passwordless;
@inject ILogger<AuthenticationConfiguration> Logger;

@if (!CurrentContext.IsPendingDelete)
{
<Panel Header="Authentication Configuration">
<p>List of configurations for your authentication tokens. Read more in the <a class="link-blue underline" href="https://docs.passwordless.dev/guide/admin-console/applications.html#authentiation-configurations" target="_blank">docs</a></p>
<p>List of configurations for your authentication tokens. Read more in the <a class="link-blue underline" href="https://docs.passwordless.dev/guide/admin-console/applications.html#authentication-configurations" target="_blank">docs</a></p>

<div>
<a class="btn-primary" href="/app/@(AppId)/settings/authentication-configuration/new">Add New Authentication Configuration</a>
Expand Down Expand Up @@ -102,7 +103,21 @@
}
}

Configurations = (await Passwordless.GetAuthenticationConfigurationsAsync()).Configurations.Select(GetEntry).ToImmutableArray();
Configurations = await GetConfigurations();
}


private async Task<IReadOnlyCollection<AuthenticationConfigurationEntry>> GetConfigurations()
{
try
{
return (await Passwordless.GetAuthenticationConfigurationsAsync()).Configurations.Select(GetEntry).ToImmutableArray();
}
catch (Exception ex)
{
Logger.LogError(ex , "Failed to retrieve authentication configurations");
return Array.Empty<AuthenticationConfigurationEntry>();
}
}

public async Task OnSelectedFormConfirmed()
Expand Down

0 comments on commit b66156e

Please sign in to comment.