diff --git a/Web/Edubase.Web.UI/Controllers/Api/ApprovalsApiController.cs b/Web/Edubase.Web.UI/Controllers/Api/ApprovalsApiController.cs index 0ebab6213..40c4d5350 100644 --- a/Web/Edubase.Web.UI/Controllers/Api/ApprovalsApiController.cs +++ b/Web/Edubase.Web.UI/Controllers/Api/ApprovalsApiController.cs @@ -5,6 +5,7 @@ using System.Threading.Tasks; using System.Web.Http; using System.Web.Mvc; +using Edubase.Services.Exceptions; namespace Edubase.Web.UI.Controllers.Api { @@ -18,8 +19,18 @@ public ApprovalsApiController(IApprovalService approvalService) } [System.Web.Http.Route("api/approvals/change-requests"), System.Web.Http.HttpGet] - public async Task GetAsync(int skip, int take, string sortBy) - => await _approvalService.GetAsync(skip, take, sortBy, User); + public async Task GetAsync(int skip, int take, string sortBy) + { + try + { + var result = await _approvalService.GetAsync(skip, take, sortBy, User); + return Ok(result); + } + catch (PermissionDeniedException) + { + return StatusCode(HttpStatusCode.Forbidden); + } + } [System.Web.Http.Route("api/approvals/change-request"), System.Web.Http.HttpPost] [ValidateAntiForgeryToken]