When opening a new tab, a privateID trumps a preexisting session-cookie.
@@ -12,6 +12,10 @@ import {
checkAccessToCurrentRoute,
} from '../configRouting';
+import {
+ stateGoCurrent,
+} from './cstm-router-actions';
+
import {
checkLoginStatus,
privateId2Credentials,
@@ -39,27 +43,27 @@ export const pageLoadAction = () => (dispatch, getState) => {
* initial page-load-speed.
* TODO fetch config data here as well
*/
- checkLoginStatus()
- /* handle data, dispatch actions */
- .then(data => loadingWhileSignedIn(dispatch, getState, data.username))
- .catch(error => {
+
const privateId = getParameterByName('privateId'); // as this is one of the first action-creators to be executed, we need to get the param directly from the url-bar instead of `state.getIn(['router','currentParams','privateId'])`
if(privateId) {
/*
* we don't have a valid session. however the url might contain `privateId`, which means
* we're accessing an "accountless"-account and need to sign in with that
*/
- loadingWithAnonymousAccount(dispatch, getState, privateId)
+ return loadingWithAnonymousAccount(dispatch, getState, privateId)
.catch(e =>
loadingWhileSignedOut(dispatch, getState)
);
+ }
- } else {
+ checkLoginStatus()
+ /* handle data, dispatch actions */
+ .then(data => loadingWhileSignedIn(dispatch, getState, data.username))
+ .catch(error => {
/*
* ok, we're really not logged in -- thus we need to fetch any publicly visible, required data
*/
loadingWhileSignedOut(dispatch, getState);
- }
});
};
