The app is working, I am able to create an account and navigate to select my role (teacher, student, coordinator)
when I log out, I erase everything.
[RelayCommand]
async Task SignOut() {
SecureStorage.Default.RemoveAll();
FlyoutHelper.GeetDefaultMenuItems();
await appService.NavigateTo($"//{nameof(LoginPage)}", true);
and then I add my default pages
public static void GeetDefaultMenuItems() {
var defaultItems = new List<ShellContent> {
new() { ContentTemplate = new DataTemplate(typeof(StartupPage)),
Route = nameof(StartupPage), FlyoutItemIsVisible = false },
new() { ContentTemplate = new DataTemplate(typeof(LoginPage)),
Route = nameof(LoginPage), FlyoutItemIsVisible = false },
new() { ContentTemplate = new DataTemplate(typeof(NoInternetPage)),
Route = nameof(NoInternetPage), FlyoutItemIsVisible = false },
new() { ContentTemplate = new DataTemplate(typeof(RoleSelectionPage)),
Route = nameof(RoleSelectionPage), FlyoutItemIsVisible = false }
};
Shell.Current.Items.Clear();
foreach(var item in defaultItems) {
Shell.Current.Items.Add(item);
}
}
}
So, in my login page, I want to check if the user I already in the database, because, if it is, that means that he has a role assigned to it
async Task Login() {
IsBusy = true;
var user = await authenticationService.LoginWithEmailAndPassword(User.Email!, User.Password!);
if(user is not null) {
var loggedUser = await authenticationService.GetLoggedInUser();
var currentUser = await dataService.GetByEmailAsync<DemyUser(Constants.USERS,
loggedUser!.Info.Email);
if(currentUser is not null) {
ShellItem shellItem = new() { Route = $"{currentUser.CurrentRole}DashboardPage" };
Shell.Current.Items.Add(shellItem);
await appService.NavigateTo($"//{currentUser.CurrentRole}DashboardPage", true);
}
await appService.NavigateTo($"//{nameof(RoleSelectionPage)}", true);]
But I get {"unable to figure out route for: //TeacherDashboardPage (Parameter 'uri')"}
Demo:
https://reccloud.com/u/d1at3wo