Commit 03b68717 authored by Wietse Kuipers's avatar Wietse Kuipers
Browse files

Merge branch 'fix/hide-login-snackbar' into 'master'

Reset login state after restoring saved login data

See merge request !67
parents 51ca3cbd 0202d736
......@@ -9,8 +9,8 @@ export function reset() {
return { type: RESET };
}
export function success(username, token, displayName, photo) {
return { type: SUCCESS, payload: { username, token, displayName, photo } };
export function success(username, token, displayName, photo, loginState = 'success') {
return { type: SUCCESS, payload: { username, token, displayName, photo, loginState } };
}
export function fetching() {
......
......@@ -10,7 +10,7 @@ import 'moment/locale/nl';
import * as reducers from './reducers';
import sagas from './sagas';
import ReduxNavigator from './components/navigator';
import { success } from './actions/login';
import * as loginActions from './actions/login';
const createStoreWithMiddleware = applyMiddleware(thunk)(createStore);
const sagaMiddleware = createSagaMiddleware();
......@@ -42,7 +42,7 @@ class Main extends Component {
const photo = values[PHOTOKEY];
if (username !== null && token !== null) {
store.dispatch(success(username, token, displayName, photo));
store.dispatch(loginActions.success(username, token, displayName, photo, ''));
}
});
}
......
......@@ -13,7 +13,7 @@ export default function session(state = initialState, action = {}) {
case loginActions.SUCCESS:
return {
...state,
loginState: 'success',
loginState: action.payload.loginState,
username: action.payload.username,
token: action.payload.token,
displayName: action.payload.displayName,
......
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