howdoyoucode пре 8 година
родитељ
комит
7ae5fdf1e6
3 измењених фајлова са 7 додато и 10 уклоњено
  1. 2 5
      frontend/app/js/actions/app.js
  2. 4 4
      frontend/app/js/reducers/user.js
  3. 1 1
      frontend/app/js/views/App/index.jsx

+ 2 - 5
frontend/app/js/actions/app.js

@@ -15,12 +15,9 @@ export function ban(reason) {
 	};
 	};
 }
 }
 
 
-export function authenticate(loggedIn, role, username, userId) {
+export function authenticate(data) {
 	return {
 	return {
 		type: AUTHENTICATE,
 		type: AUTHENTICATE,
-		loggedIn,
-		role,
-		username,
-		userId,
+		data,
 	};
 	};
 }
 }

+ 4 - 4
frontend/app/js/reducers/user.js

@@ -27,10 +27,10 @@ const actionsMap = {
 	},
 	},
 	[AUTHENTICATE]: (state, action) => {
 	[AUTHENTICATE]: (state, action) => {
 		return state.merge({
 		return state.merge({
-			loggedIn: action.loggedIn,
-			role: action.role,
-			username: action.username,
-			userId: action.userId,
+			loggedIn: action.data.loggedIn,
+			role: action.data.role,
+			username: action.data.username,
+			userId: action.data.userId,
 		});
 		});
 	},
 	},
 };
 };

+ 1 - 1
frontend/app/js/views/App/index.jsx

@@ -22,7 +22,7 @@ export default class App extends Component {
 		io.init(config.serverDomain);
 		io.init(config.serverDomain);
 		io.getSocket(socket => {
 		io.getSocket(socket => {
 			socket.on("ready", (status, role, username, userId) => {
 			socket.on("ready", (status, role, username, userId) => {
-				dispatch(authenticate(status, role, username, userId));
+				dispatch(authenticate({ status, role, username, userId }));
 			});
 			});
 			socket.on("keep.event:banned", reason => dispatch(ban(reason)));
 			socket.on("keep.event:banned", reason => dispatch(ban(reason)));
 		});
 		});