Skip to content

Commit

Permalink
Add custom FS value to identify if user is logged in (#2820)
Browse files Browse the repository at this point in the history
  • Loading branch information
phirework committed Jul 14, 2020
1 parent bcf5b6d commit 461d087
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion web/src/components/layout/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Localized } from '@fluent/react';
import * as React from 'react';
import { connect } from 'react-redux';
import { RouteComponentProps, Redirect, withRouter } from 'react-router';
import * as FullStory from '@fullstory/browser';
import { LOCALES, NATIVE_NAMES } from '../../services/localization';
import { trackGlobal, getTrackClass } from '../../services/tracker';
import StateTree from '../../stores/tree';
Expand Down Expand Up @@ -150,7 +151,7 @@ class Layout extends React.PureComponent<LayoutProps, LayoutState> {
};

async componentDidMount() {
const { locale, api } = this.props;
const { locale, api, user } = this.props;
this.scroller.addEventListener('scroll', this.handleScroll);
this.visitHash();

Expand All @@ -164,6 +165,12 @@ class Layout extends React.PureComponent<LayoutProps, LayoutState> {
challengeTeamToken !== undefined && challengeToken !== undefined,
featureStorageKey: await this.getFeatureKey(locale),
});

try {
FullStory.setUserVars({ isLoggedIn: !!user.account })
} catch(e) {
// do nothing if FullStory not initialized (see app.tsx)
}
}

componentDidUpdate(nextProps: LayoutProps, nextState: LayoutState) {
Expand Down

0 comments on commit 461d087

Please sign in to comment.