Skip to content

Commit

Permalink
(#57) add check if student not found at friend details page
Browse files Browse the repository at this point in the history
  • Loading branch information
an2508374 committed May 30, 2024
1 parent f779fa1 commit 10073cd
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions MiniSpace.Web/src/MiniSpace.Web/Pages/Friends/FriendsDetails.razor
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@
}

<h3>Student Profile</h3>

@if (studentNotFound)
{
<h3 class="rz-p-12">Student profile not found!</h3>
<h3>Probably has been deleted!</h3>
}

@if (student == null)
{
<RadzenProgress Label="Loading profile..." Mode="ProgressMode.Indeterminate" />
Expand Down Expand Up @@ -56,17 +63,20 @@ else
[Parameter] public Guid Id { get; set; }
private StudentDto student;
private string profileImage; // Store the Base64 image string
private bool studentNotFound;

protected override async Task OnInitializedAsync()
{
student = await FriendsService.GetStudentAsync(Id);
if (student != null)
if (student == null)
{
var imageResult = await MediaFilesService.GetFileAsync(student.ProfileImage);
if (imageResult != null)
{
profileImage = $"data:image/jpeg;base64,{imageResult.Base64Content}";
}
studentNotFound = true;
return;
}
var imageResult = await MediaFilesService.GetFileAsync(student.ProfileImage);
if (imageResult != null)
{
profileImage = $"data:image/jpeg;base64,{imageResult.Base64Content}";
}
}

Expand Down

0 comments on commit 10073cd

Please sign in to comment.