Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
65 lines (58 sloc) 1.6 KB
@page "/"
@page "/byHashtag/{Hashtag}"
@page "/byUser/{UserName}"
@using System.Collections.Generic
@using edu_croaker.Data.Entities
@using edu_croaker.Data.Dtos
@using edu_croaker.Services
@using Components
<div>
<AuthorizeView>
<Authorized>
<IndexTemplate>
@if (Filter == CroakFetchFilter.ByHashtag)
{
<Alert>
Results for <strong>#@Hashtag</strong>
</Alert>
<CroaksContainer Hashtag="@Hashtag" Filter="@Filter" />
}
else if (Filter == CroakFetchFilter.ByUser)
{
<UserSummaryContainer UserName="@UserName" />
<CroaksContainer UserName="@UserName" Filter="@Filter" />
}
else
{
<CroaksContainer Filter="@Filter" />
}
</IndexTemplate>
</Authorized>
<NotAuthorized>
<Login />
</NotAuthorized>
</AuthorizeView>
</div>
@code {
[Parameter]
public string Hashtag { get; set; }
[Parameter]
public string UserName { get; set; }
[Parameter]
public CroakFetchFilter Filter { get; set; } = CroakFetchFilter.Generic;
protected override void OnParametersSet()
{
if (Hashtag != null)
{
Filter = CroakFetchFilter.ByHashtag;
}
else if (UserName != null)
{
Filter = CroakFetchFilter.ByUser;
}
else
{
Filter = CroakFetchFilter.Generic;
}
}
}
You can’t perform that action at this time.