Implement identity verification feature with image upload and token management
All checks were successful
Build And Push Dev Docker Image / docker (push) Successful in 2m2s
All checks were successful
Build And Push Dev Docker Image / docker (push) Successful in 2m2s
This commit is contained in:
50
FoodsharingSiegen.Server/Dialogs/ViewImagesDialog.razor.cs
Normal file
50
FoodsharingSiegen.Server/Dialogs/ViewImagesDialog.razor.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
using Blazorise;
|
||||
using FoodsharingSiegen.Contracts.Entity;
|
||||
using FoodsharingSiegen.Server.BaseClasses;
|
||||
using FoodsharingSiegen.Server.Data.Service;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace FoodsharingSiegen.Server.Dialogs
|
||||
{
|
||||
public partial class ViewImagesDialog : FsBase
|
||||
{
|
||||
[Inject]
|
||||
public ProspectService ProspectService { get; set; } = null!;
|
||||
|
||||
[Parameter]
|
||||
public Prospect? Prospect { get; set; }
|
||||
|
||||
private bool _isLoading = true;
|
||||
private List<string> _images = new();
|
||||
private int? SelectedImageIndex { get; set; }
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
if (Prospect != null)
|
||||
{
|
||||
var result = await ProspectService.GetVerificationImagesAsync(Prospect.Id);
|
||||
if (result.Success && result.Data != null)
|
||||
{
|
||||
foreach (var image in result.Data)
|
||||
{
|
||||
var base64 = Convert.ToBase64String(image.ImageData);
|
||||
var imgSrc = $"data:{image.ContentType};base64,{base64}";
|
||||
_images.Add(imgSrc);
|
||||
}
|
||||
}
|
||||
}
|
||||
_isLoading = false;
|
||||
}
|
||||
|
||||
public static async Task ShowAsync(IModalService modalService, Prospect prospect)
|
||||
{
|
||||
var title = $"Bilder für {prospect.Name}";
|
||||
var action = new Action<ModalProviderParameterBuilder<ViewImagesDialog>>(b =>
|
||||
{
|
||||
b.Add(nameof(Prospect), prospect);
|
||||
});
|
||||
|
||||
await modalService.Show(title, action, new ModalInstanceOptions { Size = ModalSize.ExtraLarge });
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user