Update DefaultHomePageMiddleware.cs

pull/17278/head
Enis Necipoglu 2 years ago
parent 5a34f8194b
commit d7d9158ddd
No known key found for this signature in database
GPG Key ID: 1EC55E13241E1680

@ -16,23 +16,20 @@ public class DefaultHomePageMiddleware : IMiddleware, ITransientDependency
{
var featureChecker = context.RequestServices.GetRequiredService<IFeatureChecker>();
if (!await featureChecker.IsEnabledAsync(CmsKitFeatures.PageEnable))
if (await featureChecker.IsEnabledAsync(CmsKitFeatures.PageEnable))
{
return;
}
if (context.Request.Path.Value == "/")
{
var pagePublicAppService = context.RequestServices.GetRequiredService<IPagePublicAppService>();
var page = await pagePublicAppService.FindDefaultHomePageAsync();
if (page != null)
if (context.Request.Path.Value == "/")
{
context.Request.Path = $"{PageConsts.UrlPrefix}{page.Slug}";
var pagePublicAppService = context.RequestServices.GetRequiredService<IPagePublicAppService>();
var page = await pagePublicAppService.FindDefaultHomePageAsync();
if (page != null)
{
context.Request.Path = $"{PageConsts.UrlPrefix}{page.Slug}";
}
}
}
await next(context);
}
}
Loading…
Cancel
Save