I am facing an issue with keeping users logged in to the app in Ionic 4. I have tried storing credentials like email and cross-checking the user using an API, then redirecting to the menu page. However, I am experiencing a brief moment on the login page before being directed to the menu page. How can I resolve this so that the menu page opens directly upon login?
app-routing.modules.ts
import { NgModule } from '@angular/core';
import { PreloadAllModules, RouterModule, Routes } from '@angular/router';
import { AuthGuard } from './auth.guard';
const routes: Routes = [
// Route configurations here
];
@NgModule({
imports: [
RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules })
],
exports: [RouterModule]
})
export class AppRoutingModule {}
service
// HTTP GET request example
// Service logic here
******************************************************************
async displayUsername() {
// Display username logic here
}
Additionally, the service redirects to the menu page after cross-checking user credentials.
// Additional service logic for redirection