Skip to content

Commit

Permalink
refactor: wrap logic into method
Browse files Browse the repository at this point in the history
  • Loading branch information
Zac-Digital committed Jan 23, 2025
1 parent 5b43879 commit b0b8f58
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using FamilyHubs.ServiceDirectory.Shared.Dto;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Primitives;
using Microsoft.AspNetCore.Authorization;
using FamilyHubs.Referral.Web.Pages.Shared;
using FamilyHubs.SharedKernel.Identity;
using FamilyHubs.ServiceDirectory.Shared.Enums;
Expand Down Expand Up @@ -44,9 +43,7 @@ public async Task<IActionResult> OnGetAsync(string serviceId)
ReturnUrl = StringValues.IsNullOrEmpty(referer) ? Url.Page("Search") : referer.ToString();
LocalOffer = await _organisationClientService.GetLocalOfferById(serviceId);

if (!await _featureManager.IsEnabledAsync(FeatureFlag.VcfsServices)
&&
LocalOffer.ServiceType == ServiceType.InformationSharing)
if (await ShouldDisableServiceDetailPage())
{
return RedirectToPage("/Error/404");
}
Expand Down Expand Up @@ -84,6 +81,9 @@ public async Task<IActionResult> OnGetAsync(string serviceId)
return (serviceScheduleAttendingTypes, LocalOffer.Schedules.FirstOrDefault());
}

private async Task<bool> ShouldDisableServiceDetailPage() =>
!await _featureManager.IsEnabledAsync(FeatureFlag.VcfsServices) && LocalOffer.ServiceType == ServiceType.InformationSharing;

private async Task<bool> ShouldShowConnectionRequestButton()
{
if (! await _featureManager.IsEnabledAsync(FeatureFlag.ConnectDashboard))
Expand Down

0 comments on commit b0b8f58

Please sign in to comment.