Skip to content

Commit

Permalink
feat: refresh authorized user data in DiscoverPageViewModel
Browse files Browse the repository at this point in the history
  • Loading branch information
yuto-trd committed Jan 30, 2025
1 parent c08f8f1 commit 845742a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Beutl/ViewModels/ExtensionsPages/DiscoverPageViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ public sealed class DiscoverPageViewModel : BasePageViewModel, ISupportRefreshVi
private readonly ILogger _logger = Log.CreateLogger<DiscoverPageViewModel>();
private readonly CompositeDisposable _disposables = [];
private readonly DiscoverService _discover;
private readonly BeutlApiApplication _apiApp;

public DiscoverPageViewModel(BeutlApiApplication apiApp)
{
_apiApp = apiApp;
_discover = apiApp.GetResource<DiscoverService>();
DataContextFactory = new DataContextFactory(_discover, apiApp);

Expand Down Expand Up @@ -102,6 +104,11 @@ private async Task<Package[]> LoadItems(int start, int count, Activity? activity
using (await _discover.Lock.LockAsync())
{
activity?.AddEvent(new("Entered_AsyncLock"));
if (_apiApp.AuthorizedUser.Value != null)
{
await _apiApp.AuthorizedUser.Value.RefreshAsync();
}

return await _discover.GetFeatured(start, count);
}
}
Expand Down

0 comments on commit 845742a

Please sign in to comment.