I've been struggling with using ngOnInit to check if a value is set on the app's localStorage, but for some reason, it's not working as expected.
This is my current implementation:
Here is the function responsible for logging the user into the app:
async login() {
try {
await this.authService.SignUpWithEmail(this.email, this.password);
await this.router.navigate(['secundaria']);
localStorage.setItem("logged-status", "logged-in")
}
And here is how I am trying to verify if the value is in the local storage:
ngOnInit() {
if (localStorage.getItem("logged-in") !== null) {
this.navCtrl.navigateForward(["quarta"])
}
}
It appears that the code is not executing properly, which is preventing it from working at all.
If anyone has any insights or can offer assistance, I would greatly appreciate it.