Skip to content

Commit 3ffcd60

Browse files
committed
Add global userName to client state
1 parent 5cbe4a8 commit 3ffcd60

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

public/local.js

+4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ var socket = io();
66

77
// SAVING LOCAL STATE -- GLOBAL VARS (ugh)
88
var currentPlayerId;
9+
var userName;
910
var nextPlayerId;
1011
var animationId;
1112
var currentGist; // gistData: {id, url, owner}
@@ -128,6 +129,9 @@ function handleUserLogin (userData) {
128129
console.log('**************** Logged in! GitHub User Data: *********************');
129130
console.log(userData);
130131

132+
// Save user's GitHub name to local game state
133+
userName = userData.login;
134+
131135
// Update views with user's GitHub name and avatar
132136
updateLoggedInView(userData.login, userData.avatar_url);
133137

0 commit comments

Comments
 (0)