feat: add login/dashboard link to footer

This commit is contained in:
Oliver Booth 2024-02-25 15:57:59 +00:00
parent eb4777e330
commit c1e5227289
Signed by: oliverbooth
GPG Key ID: E60B570D1B7557B5

View File

@ -1,6 +1,10 @@
@using OliverBooth.Data.Blog
@using OliverBooth.Data.Web
@using OliverBooth.Services
@inject IBlogPostService BlogPostService
@inject IUserService UserService
@inject ISessionService SessionService
@{
HttpRequest request = Context.Request;
var url = new Uri($"{request.Scheme}://{request.Host}{request.Path}{request.QueryString}");
@ -129,6 +133,15 @@
<ul class="footer-nav" style="margin-top: 20px;">
<li>&copy; @DateTime.UtcNow.Year</li>
<li><a asp-page="/privacy/index">Privacy</a></li>
@if (SessionService.TryGetSession(Context.Request, out ISession? session) &&
UserService.TryGetUser(session.UserId, out _))
{
<li><a asp-page="/admin/index">Dashboard</a></li>
}
else
{
<li><a asp-page="/admin/login">Login</a></li>
}
</ul>
</div>
</footer>