File tree Expand file tree Collapse file tree 2 files changed +33
-12
lines changed
demo/aspnetcore6.0/v4/BlazorTransitionableRouteDemoWasm/Client Expand file tree Collapse file tree 2 files changed +33
-12
lines changed Original file line number Diff line number Diff line change 11<CascadingAuthenticationState >
22 <Router AppAssembly =" @typeof(App).Assembly" >
33 <Found Context =" routeData" >
4- <AuthorizeRouteView RouteData =" @routeData" DefaultLayout =" @typeof(MainLayout)" >
5- <NotAuthorized >
6- @if (context .User .Identity ? .IsAuthenticated != true )
7- {
8- <RedirectToLogin />
9- }
10- else
11- {
12- <p role =" alert" >You are not authorized to access this resource .</p >
13- }
14- </NotAuthorized >
15- </AuthorizeRouteView >
4+ <LayoutView Layout =" @typeof(MainLayout)" >
5+ <TransitionableRoutePrimary RouteData =" @routeData" ForgetStateOnTransition =" true" >
6+ <MyAuthorizeRouteView DefaultLayout =" @typeof(MyViewLayout)" />
7+ </TransitionableRoutePrimary >
8+ <TransitionableRouteSecondary RouteData =" @routeData" ForgetStateOnTransition =" true" >
9+ <MyAuthorizeRouteView DefaultLayout =" @typeof(MyViewLayout)" />
10+ </TransitionableRouteSecondary >
11+ </LayoutView >
1612 <FocusOnNavigate RouteData =" @routeData" Selector =" h1" />
1713 </Found >
1814 <NotFound >
Original file line number Diff line number Diff line change 1+ @if (Transition ? .RouteData != null )
2+ {
3+ <CascadingValue Value =" Transition" >
4+ <AuthorizeRouteView RouteData =" @Transition.RouteData" DefaultLayout =" @DefaultLayout" >
5+ <NotAuthorized >
6+ @if (context .User .Identity ? .IsAuthenticated != true )
7+ {
8+ <RedirectToLogin />
9+ }
10+ else
11+ {
12+ <p role =" alert" >You are not authorized to access this resource .</p >
13+ }
14+ </NotAuthorized >
15+ </AuthorizeRouteView >
16+ </CascadingValue >
17+ }
18+
19+ @code {
20+ [CascadingParameter ]
21+ public Transition Transition { get ; set ; }
22+
23+ [Parameter ]
24+ public Type DefaultLayout { get ; set ; }
25+ }
You can’t perform that action at this time.
0 commit comments