Results 1 to 3 of 3

Thread: Please help!!!! Cannot save user login data to localStorage

  1. #1
    Sencha User
    Join Date
    Jul 2012
    Posts
    11
    Vote Rating
    0
      0  

    Default Please help!!!! Cannot save user login data to localStorage

    I have a "Home" view extends Dataview, and a "Login" view extends form.Panel. In home view, there is a store with url = "http://localhost/getInfo.php?userID=" + localStorage.getItem('userID')
    When user login, I save the UserID to localstorage, remove the login view, and add this home view.

    The problem I have right now is, there won't be any value returned from localStorage.getItem('userID') for the first time login, and will return the userID of the first user when the second user log in later.

    I guess this problem is caused by the order of creating classes.
    In my code, the order is: setItem('userID', id) -> Ext.create('Main') -> Ext.destory('Login')

    Could anyone provide a suggestion of what may caused this problem and maybe how to solve it?

    Thanks in advance!

    Best best regards

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,556
    Answers
    3932
    Vote Rating
    1272
      0  

    Default

    What is the problem? If getItem doesn't return something then create the Login view. If it does then create the Main view.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  3. #3
    Sencha User
    Join Date
    Jul 2012
    Posts
    11
    Vote Rating
    0
      0  

    Default

    Thank you. I found the answer from your other reply. Initially, I set autoload to true, which let the store load resources before I add extraparams in the url. So, the solution is to set autoload to false, and use setUrl() method when I get response back from the server.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •