Add user id to logger

This commit is contained in:
Hannu Lyytikainen 2017-09-27 12:56:30 +03:00
parent 5bf9d0f072
commit 796bf17c93
3 changed files with 7 additions and 1 deletions

View file

@ -9,6 +9,7 @@ import { withFlattenedRoutes, withViewport } from '../../util/contextHelpers';
import { parse, stringify } from '../../util/urlHelpers';
import { createResourceLocatorString, pathByRouteName } from '../../util/routes';
import * as propTypes from '../../util/propTypes';
import { clearUserId } from '../../util/log';
import {
Button,
IconEmailAttention,
@ -145,6 +146,9 @@ class TopbarComponent extends Component {
window.location = path;
}
// clear user id from logger
clearUserId();
// TODO: show flash message
console.log('logged out'); // eslint-disable-line
});

View file

@ -160,7 +160,6 @@ export class SearchPageComponent extends Component {
sendVerificationEmailError,
onResendVerificationEmail,
} = this.props;
// eslint-disable-next-line no-unused-vars
const { boundsChanged, page, ...searchInURL } = parse(location.search, {
latlng: ['origin'],

View file

@ -1,6 +1,7 @@
import { authInfo } from './Auth.duck';
import { updatedEntities, denormalisedEntities } from '../util/data';
import { TX_TRANSITION_PREAUTHORIZE } from '../util/propTypes';
import { setUserId } from '../util/log';
// ================ Action types ================ //
@ -337,6 +338,8 @@ export const fetchCurrentUser = () =>
const entities = updatedEntities({}, response.data);
const denormalised = denormalisedEntities(entities, 'current-user', [currentUserId]);
const currentUser = denormalised[0];
// set current user id to the logger
setUserId(currentUser.id);
dispatch(currentUserShowSuccess(currentUser));
return currentUser;
})