Commit e3509d58 authored by Roger Jungemann's avatar Roger Jungemann
Browse files

Simplified login finished

parent ed6c0167
......@@ -265,6 +265,7 @@ const mapStateToProps = (state, ownProps) => {
]);
}
// TODO: Cleanup
const userPath = state.routing.locationBeforeTransitions.pathname;
const username = state.user.getIn(['current', 'username']);
const loggedIn = !!username;
......
......@@ -166,8 +166,13 @@ export default function reducer(state = defaultState, action) {
return state; // saga
case SET_USERNAME:
return state.merge({
username: payload.username,
// TODO: Clean this up
return state.mergeDeep({
current: payload,
show_login_modal: false,
loginBroadcastOperation: undefined,
loginDefault: undefined,
logged_out: undefined,
});
case SET_USER:
......
......@@ -104,14 +104,13 @@ function* usernameLogin(action) {
const username = action.payload.username;
sessionStorage.setItem('username', username);
serverApiRecordEvent('SignIn', 'Login');
userActions.setUsername({ username });
console.log('SIGN IN: Signed in', action);
yield put(userActions.setUsername({ username }));
} else {
const username = sessionStorage.getItem('username');
if (username) {
userActions.setUsername({ username });
console.log('SIGN IN: Already signed in', action, username);
yield put(userActions.setUsername({ username }));
} else {
// TODO: Finish this
console.log('SIGN IN: Not signed in', action);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment