Closed susandaiute closed 8 years ago
Hmm what changed from where it was? Is the user object no longer defined? Did something change in setting that on login?
I'm not sure. The same thing happens when I go to sign out as well.
What's printing to the console from where console.log(app)
is at the top of the function block?
I'm not seeing anything printed actually.
Is this function in app.js at line 44? If not, where is it?
Sorry, which function? updatePassword?
Yeah
It's in api.js, but begins at line 34. Line 44 is:
url: app.api + '/change-password/' + app.user.id,
So the error is saying that user
right there is undefined. Also, if that line is being run, the console.log(app) should have fired. Can you double check your browser's console for that log?
Sure!
I'm not seeing it. From refreshing the page to trying to update password and then sign out, the console reads:
Navigated to http://localhost:8080/ events.js:12 Object {credentials: Object} ui.js:20 Object {user: Object} api.js:35 Object {api: "http://tic-tac-toe.wdibos.com"} api.js:44 Uncaught TypeError: Cannot read property 'id' of undefinedupdatePassword @ api.js:44(anonymous function) @ events.js:27jQuery.event.dispatch @ jquery.js:4737elemData.handle @ jquery.js:4549 api.js:26 Uncaught TypeError: Cannot read property 'id' of undefinedsignOut @ api.js:26(anonymous function) @ events.js:22jQuery.event.dispatch @ jquery.js:4737elemData.handle @ jquery.js:4549
Is this your browser's console? Not the grunt console in your terminal, right?
Could you try again, but add a debugger after that console.log(app)
line?
It is indeed the browser console. I'll add the debugger.
When I hove over app, I get: "http://tic-tac-toe.wdibos.com" user : Object email : "susan@gmail.com" id : 418 token : "954244701a34c2c9694614b8dac7e9c1" proto : Object proto : Object
Hmmmmmmmm....
Are there any linter errors? Could something somewhere else in the code be throwing this off?
The only one is in ui.js that says data is defined but never used, line 10.
const signOutSuccess = (data) => { //this is line 10
app.user = null;
console.log(app);
};
Hmm, okay. This is really strange. @J-Weeks or @RDegnen, if you're still up, do you have any idea? This was working and looked exactly like this when I saw it a couple of hours ago, and she's seeing the app.user.id defined when using the debugger now...
It broke at some point during my commute which I think makes this the MBTA's fault.
Hah. They're great for devastatingly ruining things. How much would you lose by rolling back to your latest commit if you had to?
Nothing. I just turned my computer on
Should I hard reset?
Oh, nothing at all has changed? Then maybe try quitting (ctrl+c) your grunt server and restarting...
ughhhh it worked!!!!!!
Hahahahahaha oh man
gg! thanks lauren!!!!!
When I go to update a password I get the error: api.js:44 Uncaught TypeError: Cannot read property 'id' of undefinedupdatePassword @ api.js:44(anonymous function) @ events.js:27jQuery.event.dispatch @ jquery.js:4737elemData.handle @ jquery.js:4549 2client?cd17:25 [WDS] App updated. Recompiling...
Relevant code:
Line 44 of api.js is :