Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ysmoradi committed Dec 20, 2024
1 parent 22949bc commit 07db5bb
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
@inherits AppComponentBase

@{
var imageUrl = User?.ProfileImageName is null ? null : $"{profileImageUrl}&file={User.ProfileImageName}";
}

<section>
<BitStack HorizontalAlign="BitAlignment.Center">
@if (Loading)
Expand Down Expand Up @@ -32,7 +28,7 @@
@if (isUploading is false)
{
<BitPersona HidePersonaDetails
ImageUrl="@imageUrl"
ImageUrl="@profileImageUrl"
PrimaryText="@User?.FullName"
Size=@BitPersonaSize.Size72
Presence="@(IsOnline is null ? BitPersonaPresence.None : IsOnline is true ? BitPersonaPresence.Online : BitPersonaPresence.Offline)" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ public partial class ProfileSection
private BitFileUpload fileUploadRef = default!;
private readonly EditUserDto editUserDto = new();


protected override async Task OnInitAsync()
{
var accessToken = await PrerenderStateService.GetValue(AuthTokenProvider.GetAccessToken);
Expand All @@ -34,11 +33,13 @@ protected override async Task OnInitAsync()

protected override void OnParametersSet()
{
User!.Patch(editUserDto);

profileImageUrl = new Uri(AbsoluteServerAddress, $"/api/Attachment/GetProfileImage/{User!.Id}?version={User.ConcurrencyStamp}").ToString();

base.OnParametersSet();

if (User is not null)
{
User.Patch(editUserDto);
profileImageUrl = new Uri(AbsoluteServerAddress, $"/api/Attachment/GetProfileImage/{User.Id}?file={User.ProfileImageName}&version={User.ConcurrencyStamp}").ToString();
}
}


Expand Down Expand Up @@ -99,7 +100,9 @@ private async Task HandleOnUploadComplete()
{
var updatedUser = await userController.GetCurrentUser(CurrentCancellationToken);

User.ProfileImageName = updatedUser.ProfileImageName;
updatedUser.Patch(User);

profileImageUrl = new Uri(AbsoluteServerAddress, $"/api/Attachment/GetProfileImage/{User.Id}?file={User.ProfileImageName}&version={User.ConcurrencyStamp}").ToString();

PublishUserDataUpdated();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public async Task RemoveProfileImage(CancellationToken cancellationToken)

[AllowAnonymous]
[HttpGet("{userId}")]
[ResponseCache(Duration = 7 * 24 * 3600, Location = ResponseCacheLocation.Any)]
[ResponseCache(Duration = 7 * 24 * 3600, Location = ResponseCacheLocation.Any, VaryByQueryKeys = new string[] { "*" })]
public async Task<IActionResult> GetProfileImage(Guid userId, CancellationToken cancellationToken)
{
var user = await userManager.FindByIdAsync(userId.ToString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public partial class StatisticsController : AppControllerBase, IStatisticsContro

[AllowAnonymous]
[HttpGet("{packageId}")]
[ResponseCache(Duration = 1 * 24 * 3600, Location = ResponseCacheLocation.Any)]
[ResponseCache(Duration = 1 * 24 * 3600, Location = ResponseCacheLocation.Any, VaryByQueryKeys = new string[] { "*" })]
public async Task<NugetStatsDto> GetNugetStats(string packageId, CancellationToken cancellationToken)
{
return await nugetHttpClient.GetPackageStats(packageId, cancellationToken);
Expand Down

0 comments on commit 07db5bb

Please sign in to comment.