Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Problem with localStorage #126

Open
valentin1009 opened this issue Oct 13, 2021 · 3 comments
Open

Problem with localStorage #126

valentin1009 opened this issue Oct 13, 2021 · 3 comments
Labels
question Further information is requested

Comments

@valentin1009
Copy link

There is a problem with localStorage on Incognito (Google Chrome). I tried to figure out what's wrong and i found the possibility to set the storage but the defaultStorage in constructor.js already "called" the localStorage. So this chance is gone.

@leomp12
Copy link
Member

leomp12 commented Nov 11, 2021

Hey @valentin1009 ,

I didn't understand what you mean, what's the problem with localStorage at all? What error exactly appeared to you?

You want to use custom Store object?

import { EcomCart } from '@ecomplus/shopping-cart'

const cart = new EcomCart(100, 'ecomShoppingCart', customStorageObject)

@leomp12 leomp12 added the question Further information is requested label Nov 11, 2021
@valentin1009
Copy link
Author

valentin1009 commented Dec 9, 2021

Hey @leomp12,

Yes i know, but there is a specific case:

  • the cart is included in a web page which could be embed
  • test this case in incognito because in incognito window i think is restricted

I get this error: Failed to read the 'localStorage' property from 'Window'. The error point to constructor.js line 14

@leomp12
Copy link
Member

leomp12 commented Dec 20, 2021

You may have to create a customStorageObject simulating Storage interface but using cookies to manipulate data, or just don't persisting it if not necessary for you.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants