refactor(HomeController): update EnvelopeLocked to use _mediator
This commit is contained in:
parent
b78aff102a
commit
beada59593
@ -17,7 +17,6 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Localization;
|
||||
using Newtonsoft.Json;
|
||||
using OtpNet;
|
||||
using System.Security.Claims;
|
||||
using EnvelopeGenerator.Domain.Constants;
|
||||
|
||||
namespace EnvelopeGenerator.Web.Controllers;
|
||||
@ -110,20 +109,18 @@ public class HomeController : ViewControllerBase
|
||||
|
||||
[HttpGet("{envelopeReceiverId}/Locked")]
|
||||
[Obsolete("Use DigitalData.Core.Exceptions and .Middleware")]
|
||||
public async Task<IActionResult> EnvelopeLocked([FromRoute] string envelopeReceiverId)
|
||||
public async Task<IActionResult> EnvelopeLocked([FromRoute] string envelopeReceiverId, CancellationToken cancel)
|
||||
{
|
||||
try
|
||||
{
|
||||
var envRcv = await _envRcvService.ReadByEnvelopeReceiverIdAsync(envelopeReceiverId: envelopeReceiverId);
|
||||
if (envRcv.IsFailed)
|
||||
var er = await _mediator.ReadEnvelopeReceiverAsync(envelopeReceiverId, cancel);
|
||||
|
||||
if (er is null)
|
||||
{
|
||||
_logger.LogNotice(envRcv.Notices);
|
||||
Response.StatusCode = StatusCodes.Status401Unauthorized;
|
||||
return this.ViewEnvelopeNotFound();
|
||||
}
|
||||
|
||||
var er = envRcv.Data;
|
||||
|
||||
if (User.IsInRole(ReceiverRole.FullyAuth))
|
||||
return await CreateShowEnvelopeView(envelopeReceiverId, er);
|
||||
else
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user