optrimization to eliminate file lookup in Logo control
This commit is contained in:
parent
e7a48f3909
commit
6345335be2
|
@ -1,24 +1,11 @@
|
|||
@namespace Oqtane.Themes.Controls
|
||||
@inherits ThemeControlBase
|
||||
@inject IFileService FileService
|
||||
|
||||
@if (file != null)
|
||||
@if (PageState.Site.LogoFileId != null)
|
||||
{
|
||||
<span class="app-logo">
|
||||
<a href="@PageState.Alias.Path">
|
||||
<img class="img-fluid" src="@file.Url" alt="@PageState.Site.Name" />
|
||||
<img class="img-fluid" src="@Utilities.FileUrl(PageState.Alias, PageState.Site.LogoFileId.Value)" alt="@PageState.Site.Name" />
|
||||
</a>
|
||||
</span>
|
||||
}
|
||||
|
||||
@code {
|
||||
private File file = null;
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
if (PageState.Site.LogoFileId != null && file?.FileId != PageState.Site.LogoFileId.Value)
|
||||
{
|
||||
file = await FileService.GetFileAsync(PageState.Site.LogoFileId.Value);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user