Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Unhandled Runtime Error SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data #8

Open
Awais512 opened this issue Nov 23, 2021 · 2 comments

Comments

@Awais512
Copy link

},
12 | userInfo: Cookies.get('userInfo')

13 | ? JSON.parse(Cookies.get('userInfo'))
| ^
14 | : null,

Giving error in the store here. I don't know whats the problem is
Screenshot 2021-11-23 at 19-26-41 Amazona

Here is the screenshot above

@MohammadSahabuddin
Copy link

MohammadSahabuddin commented Nov 29, 2021

}, 12 | userInfo: Cookies.get('userInfo')

13 | ? JSON.parse(Cookies.get('userInfo'))
| ^
14 | : null,

Giving error in the store here. I don't know whats the problem is Screenshot 2021-11-23 at 19-26-41 Amazona

Here is the screenshot above

just in Store.js add JSON.stringify

like::

userInfo: Cookies.get('userInfo') ? JSON.parse(JSON.stringify(Cookies.get('userInfo'))) : null,

@back2basic
Copy link

Cookies.set('userInfo', JSON.stringify(data));
In your login.js fixes the issue. You have to convert the object to string so it can be stored properly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants