You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I need access to IAuthenticationService to make sure that the user is logged in before navigating to a certain page.
The following code is based on the doc example here
private static void RegisterRoutes(IViewRegistry views, IRouteRegistry routes)
{
new ("Login", View: views.FindByViewModel<LoginViewModel>()),
new ("Main", View: views.FindByViewModel<MainViewModel>(),
Init: (request) =>
{
// Need to check if user is logged in
IAuthenticationService authService = ....
return request;
}),
}
in the Uno App template the previous method is called by the UseNavigation method of IHostBuilder:
var builder = this.CreateBuilder(args)
.Configure(host => host
....
.UseNavigation(ReactiveViewModelMappings.ViewModelMappings, RegisterRoutes);
How can I get an instance of IAuthenticationService in the Init callback?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I need access to
IAuthenticationServiceto make sure that the user is logged in before navigating to a certain page.The following code is based on the doc example here
in the Uno App template the previous method is called by the
UseNavigationmethod of IHostBuilder:How can I get an instance of
IAuthenticationServicein the Init callback?Beta Was this translation helpful? Give feedback.
All reactions