File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed
LinkDotNet.Blog.Web/Pages Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change 1
1
@page " /AboutMe"
2
- @using Microsoft .AspNetCore .Http
3
2
@inject AppConfiguration appConfiguration
4
- @inject IHttpContextAccessor httpContextAccessor
3
+ @inject AuthenticationStateProvider authenticationStateProvider
5
4
@* TODO: Meta Tags About Me - [Name here] *@
6
5
7
6
@if (appConfiguration .IsAboutMeEnabled )
10
9
<div class =" container" >
11
10
<div class =" row" >
12
11
<div class =" col-lg-3 col-md-4" >
13
- <Profile IsAuthenticated =" @httpContextAccessor.HttpContext.User.Identity.IsAuthenticated " />
12
+ <Profile IsAuthenticated =" @isAuthenticated " />
14
13
</div >
15
14
<div class =" col-lg-9 col-md-8 tab-container" >
16
15
<div class =" row" >
19
18
</div >
20
19
</div >
21
20
</div >
21
+ }
22
+
23
+ @code {
24
+
25
+ private bool isAuthenticated ;
26
+
27
+ protected override async Task OnInitializedAsync ()
28
+ {
29
+ var userIdentity = (await authenticationStateProvider .GetAuthenticationStateAsync ()).User .Identity ;
30
+ if (userIdentity != null )
31
+ {
32
+ isAuthenticated = userIdentity .IsAuthenticated ;
33
+ }
34
+ }
35
+
22
36
}
You can’t perform that action at this time.
0 commit comments