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

Client, add catch TokenUnavailableException in SetHourPrice method. #1056

Merged
merged 1 commit into from
Nov 26, 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
2 changes: 1 addition & 1 deletion src/FoxIDs.Control/FoxIDs.Control.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Version>1.12.7</Version>
<Version>1.12.8</Version>
<RootNamespace>FoxIDs</RootNamespace>
<Authors>Anders Revsgaard</Authors>
<Company>ITfoxtec</Company>
Expand Down
2 changes: 1 addition & 1 deletion src/FoxIDs.ControlClient/FoxIDs.ControlClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Version>1.12.7</Version>
<Version>1.12.8</Version>
<RootNamespace>FoxIDs.Client</RootNamespace>
<Authors>Anders Revsgaard</Authors>
<Company>ITfoxtec</Company>
Expand Down
19 changes: 13 additions & 6 deletions src/FoxIDs.ControlClient/Pages/Usage/Usage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -249,15 +249,22 @@ private async Task UsedViewModelAfterInitAsync(GeneralUsedViewModel generalUsed,

private async Task SetHourPrice(GeneralUsedViewModel generalUsed)
{
var tenant = await TenantService.GetTenantAsync(generalUsed.TenantName);
if (tenant.HourPrice > 0)
try
{
generalUsed.HourPrice = tenant.HourPrice.Value;
var tenant = await TenantService.GetTenantAsync(generalUsed.TenantName);
if (tenant.HourPrice > 0)
{
generalUsed.HourPrice = tenant.HourPrice.Value;
}
else
{
var rate = GetExchangesRate(tenant.Currency, usageSettings.CurrencyExchanges);
generalUsed.HourPrice = decimal.Round(usageSettings.HourPrice * rate, 2);
}
}
else
catch (TokenUnavailableException)
{
var rate = GetExchangesRate(tenant.Currency, usageSettings.CurrencyExchanges);
generalUsed.HourPrice = decimal.Round(usageSettings.HourPrice * rate, 2);
await (OpenidConnectPkce as TenantOpenidConnectPkce).TenantLoginAsync();
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/FoxIDs.ControlShared/FoxIDs.ControlShared.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Version>1.12.7</Version>
<Version>1.12.8</Version>
<RootNamespace>FoxIDs</RootNamespace>
<Authors>Anders Revsgaard</Authors>
<Company>ITfoxtec</Company>
Expand Down
2 changes: 1 addition & 1 deletion src/FoxIDs.Shared/FoxIDs.Shared.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Version>1.12.7</Version>
<Version>1.12.8</Version>
<RootNamespace>FoxIDs</RootNamespace>
<Authors>Anders Revsgaard</Authors>
<Company>ITfoxtec</Company>
Expand Down
2 changes: 1 addition & 1 deletion src/FoxIDs.SharedBase/FoxIDs.SharedBase.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Version>1.12.7</Version>
<Version>1.12.8</Version>
<RootNamespace>FoxIDs</RootNamespace>
<Authors>Anders Revsgaard</Authors>
<Company>ITfoxtec</Company>
Expand Down
2 changes: 1 addition & 1 deletion src/FoxIDs/FoxIDs.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Version>1.12.7</Version>
<Version>1.12.8</Version>
<RootNamespace>FoxIDs</RootNamespace>
<Authors>Anders Revsgaard</Authors>
<Company>ITfoxtec</Company>
Expand Down