[LOCALSTORAGE] How open page only once if user login?


#1

Hi guys, how can I configure my code to open the page only once if the user logs in?

Thanks!


#2

What does Local Storage have to do with this?


#3

I can not store the recorded data on this page and then not open it anymore? I’m a novice with Ionic 3 but I think it uses localstorage…


#4

I don’t understand what you want to do.


#5

Don’t post screenshots of code.


#6

When I start my application the Welcome page appears and I login, right? But if I close the application after logging in and then open it again the Welcome page will still appear! If I am already logged in I want to start the application already on another page.


#7

Sure, you can save the auth info in Ionic Storage, and check whether there is auth info when you start your app. What part of the Ionic Storage docs are you having trouble with?


#8

#1 - I instaled the plugins for localstore,
#2 - add in app.module.ts: import { IonicStorageModule } from “@ionic/storage”;
#3 - add in imports: IonicStorageModule
Then I went to my other page.
#4 - add import { IonicStorageModule } from ‘@ionic/storage’;
#5 - add in constructor: private storage: IonicStorageModule
#6 - Error found in method when: storage.set
Error: "[ts] Property ‘set’ does not exist on type ‘IonicModuleStorage’.

I’m reading the commands here:https://ionicframework.com/docs/storage/


#9

IonicStorageModule is not the same as IonicModueStorage.


#10

I am storing the info whether user already seen the introduction page or not, in login function I have something like this:

if (this.settingsService.Slides != false) {
        this.navCtrl.setRoot(IntroductionPage);
      } else {
        this.navCtrl.setRoot(HomePage);
      }

#11

!= false is not a very common or reliable idiom, because JavaScript has many “falsy” values that you generally want to treat identically. I posted something recently about the danger inherent in exposing public properties of service providers; is it possible that it is relevant to your situation?