Skip to content

Instantly share code, notes, and snippets.

@0xrohan10
Created November 22, 2016 17:58
Show Gist options
  • Select an option

  • Save 0xrohan10/dcd7c33cc7f1b738b72f00d87f7b7fa5 to your computer and use it in GitHub Desktop.

Select an option

Save 0xrohan10/dcd7c33cc7f1b738b72f00d87f7b7fa5 to your computer and use it in GitHub Desktop.
/**
* Middleware for Drift, allowing user identification
*/
import { LOAD_USER_DETAILS } from '../constants/auth.constants';
const drift = window.drift ? window.drift : () => {};
const driftLogger = store => next => action => {
if (action.type === LOAD_USER_DETAILS) {
drift.identify(
action.auth.user,
{
email: action.auth.email,
companyId: action.auth.companyId
}
);
}
return next(action);
}
export default driftLogger;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment