feat: 登录成功后更新posthog的身份认证

pull/56/head
moonrailgun 3 years ago
parent 72f5d68a56
commit 4beb9c9505

@ -1,4 +1,5 @@
import posthog from 'posthog-js'; import posthog from 'posthog-js';
import { sharedEvent } from '@capital/common';
posthog.init('phc_xRCv3qbbOBMQkz31kbYMngXxn7Ey5JMu0BZIFktO6km', { posthog.init('phc_xRCv3qbbOBMQkz31kbYMngXxn7Ey5JMu0BZIFktO6km', {
api_host: 'https://app.posthog.com', api_host: 'https://app.posthog.com',
@ -25,3 +26,12 @@ setTimeout(() => {
// Ignore error // Ignore error
} }
}, 2000); }, 2000);
sharedEvent.on('loginSuccess', (userInfo) => {
posthog.identify(userInfo._id, {
email: userInfo.email,
username: `${userInfo.nickname}#${userInfo.discriminator}`,
avatar: userInfo.avatar,
temporary: userInfo.temporary,
});
});

Loading…
Cancel
Save