postit: persist settings save and apply ApiUrl changes without restart
This commit is contained in:
parent
45d3f1f4f8
commit
bfbcaeb400
8 changed files with 84 additions and 30 deletions
|
|
@ -39,6 +39,22 @@ public class ActivitiesPageViewModelTests
|
|||
Assert.Equal("https://business.example/api/v1/billing/Rdv", api.Paths[3]);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ActivityApiClient_uses_updated_business_base_without_restart()
|
||||
{
|
||||
var api = new StubActivityApi();
|
||||
var baseUrl = "https://business-a.example/api/v1/";
|
||||
var client = new ActivityApiClient(api, () => baseUrl);
|
||||
|
||||
await client.GetCatalogAsync(ct: TestContext.Current.CancellationToken);
|
||||
|
||||
baseUrl = "https://business-b.example/api/v1/";
|
||||
await client.GetUsersAsync("brush", TestContext.Current.CancellationToken);
|
||||
|
||||
Assert.Equal("https://business-a.example/api/v1/activity/catalog", api.Paths[0]);
|
||||
Assert.Equal("https://business-b.example/api/v1/activity/brush/users", api.Paths[1]);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task RefreshAsync_loads_first_activity_then_specialization_performers()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -26,9 +26,9 @@ public static class ServiceCollectionHelpers
|
|||
var userSearchClient = new UserSearchClient(api, settings.BlogsApiUrl);
|
||||
var activityClient = new ActivityApiClient(
|
||||
api,
|
||||
settings.ApiUrl,
|
||||
settings.Authentication?.Authority);
|
||||
var billingClient = new BillingApiClient(api, settings.ApiUrl);
|
||||
() => settings.ApiUrl,
|
||||
() => settings.Authentication?.Authority);
|
||||
var billingClient = new BillingApiClient(api, () => settings.ApiUrl);
|
||||
var userDirectory = new UserDirectory(userSearchClient);
|
||||
|
||||
// Vues
|
||||
|
|
|
|||
|
|
@ -61,16 +61,11 @@
|
|||
Click="ChooseAvatar_Click"
|
||||
Margin="0,0,8,0"/>
|
||||
|
||||
<!-- Sauver: bound to the Save RelayCommand on the Settings
|
||||
VM. The source generator emits an ICommand property whose
|
||||
name matches the source method exactly (no "Command"
|
||||
suffix is added), so we bind {Binding Save} here. See
|
||||
AGENTS.md "Avalonia + CommunityToolkit.Mvvm : conventions
|
||||
de binding pour [RelayCommand]" for the full rationale.
|
||||
IsEnabled tracks IsDirty so the button auto-disables
|
||||
when there's nothing to persist. -->
|
||||
<!-- Sauver: bind to the RelayCommand-generated property
|
||||
(SaveCommand). IsEnabled tracks IsDirty so the button
|
||||
auto-disables when there's nothing to persist. -->
|
||||
<Button Content="Sauver"
|
||||
Command="{Binding Save}"
|
||||
Command="{Binding SaveCommand}"
|
||||
IsEnabled="{Binding IsDirty}"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
},
|
||||
"RedirectUri": "postit://callback",
|
||||
"DarkMode": false,
|
||||
"ApiUrl": "https://blogs.pschneider.fr/api/v1/",
|
||||
"ApiUrl": "https://api.pschneider.fr/api/v1/",
|
||||
"Scopes": [
|
||||
"openid",
|
||||
"profile",
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
},
|
||||
"RedirectUri": "postit://callback",
|
||||
"DarkMode": true,
|
||||
"ApiUrl": "https://blogs.pschneider.fr/api/v1/",
|
||||
"ApiUrl": "https://api.pschneider.fr/api/v1/",
|
||||
"Scopes": [
|
||||
"openid",
|
||||
"profile",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue