Skip to content

Signup Error: undefined Can't find variable: localStorage #4890

Closed
@pulkitsapra

Description

@pulkitsapra

Issue Description

When i try to signup using the following code

import ParseReact from 'parse-react/react-native';
import Parse from 'parse';

Parse.initialize(
  'myAppId',
);
Parse.serverURL = 'http://localhost:1337/parse';

async setnewuser(username , password){
    var user = new Parse.User();
    user.set('username',username);
    user.set('password',password);
    alert(user)

    user.signUp(null, {
    success: function(user) {
      // Hooray! Let them use the app now.
    },
    error: function(user, error) {
      // Show the error message somewhere and let the user try again.
      alert("Error: " + error.code + " " + error.message);
    }
   });
  }
    

I get the error as "undefined: Can't find variable:localStorage"

Can someone help in resolving this issue. I use parse server 1.11.1

********UPDATE ******
I installed package localstorage-polyfill
import 'localstorage-polyfill'
and it works fine now

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions