safak / youtube

5.04k stars 5.47k forks source link

Cannot read properties of null (reading 'accessToken') #31

Closed ayadgu closed 2 years ago

ayadgu commented 2 years ago

I've just cloned the repo, installed dependencies of both api/client with yarn and then yarn started them.

As soon as localholst:3000 opens, I face this error : image

JohnnyHaick commented 2 years ago

Having the same issue. Any help?

opholroyd commented 2 years ago

Try researching setItem method for localStorage and try setting it?

tarunkumargit commented 2 years ago

@Sseast any solution for this?

shinboizz commented 2 years ago

I've just cloned the repo, installed dependencies of both api/client with yarn and then yarn started them.

As soon as localholst:3000 opens, I face this error : image

I have the same error as you. Did you fix it yet? help me

daman9999 commented 2 years ago

this might not be the best solution but try wrapping it in try catch block eg: let TOKEN ="" try{ TOKEN = JSON.parse(JSON.parse(localStorage.getItem("persist:root")).user).currentUser.accessToken || " "; } catch(err){ console.log(err); }

for me it works.... :)

shinboizz commented 2 years ago

this might not be the best solution but try wrapping it in try catch block eg: let TOKEN ="" try{ TOKEN = JSON.parse(JSON.parse(localStorage.getItem("persist:root")).user).currentUser.accessToken || " "; } catch(err){ console.log(err); }

for me it works.... :)

support me , please. My email: phuquangle5@gmail.com

daman9999 commented 2 years ago

this might not be the best solution but try wrapping it in try catch block eg: let TOKEN ="" try{ TOKEN = JSON.parse(JSON.parse(localStorage.getItem("persist:root")).user).currentUser.accessToken || " "; } catch(err){ console.log(err); } for me it works.... :)

support me , please. My email: phuquangle5@gmail.com

do you want me to send you the code

shinboizz commented 2 years ago

this might not be the best solution but try wrapping it in try catch block eg: let TOKEN ="" try{ TOKEN = JSON.parse(JSON.parse(localStorage.getItem("persist:root")).user).currentUser.accessToken || " "; } catch(err){ console.log(err); } for me it works.... :)

support me , please. My email: phuquangle5@gmail.com

do you want me to send you the code Yes, Can you help me edit the code?

daman9999 commented 2 years ago

me ed

yes ofcourse

senapahlevi commented 2 years ago

me ed

yes ofcourse

hey pleasse email me share your fixed code i getting stuck to: senapahlevi1@gmail.com

safak commented 2 years ago

fixed