rxjs#throwError JavaScript Examples
The following examples show how to use
rxjs#throwError.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: App.js From HackShack-Session-Landing-Page with MIT License | 4 votes |
App = () => {
let gtagId;
let gaDebug;
if (process.env.REACT_APP_NODE_ENV === 'production') {
gtagId = process.env.REACT_APP_GOOGLE_ANALYTICS_ID;
gaDebug = false;
} else if (process.env.REACT_APP_NODE_ENV === 'development') {
gtagId = 'UA-NNNNNN-N';
gaDebug = false;
} else {
throwError(
"REACT_APP_NODE_ENV not set to 'production' nor 'development'." +
'Google Analytics tracking will not be initialized.',
);
}
ReactGA.initialize(gtagId, {
debug: gaDebug,
});
const history = createBrowserHistory();
history.listen(location => {
ReactGA.set({ page: location.pathname });
ReactGA.pageview(location.pathname);
});
useEffect(() => {
if (typeof window !== 'undefined') {
const { location } = window;
ReactGA.set({ page: location.pathname });
ReactGA.pageview(location.pathname);
}
}, []);
return (
<Grommet
theme={customHpe}
themeMode="dark"
background="#151d29"
style={{ overflowX: 'hidden' }}
>
<Router history={history}>
<ScrollToTop />
<Switch>
<Route exact path="/">
<Home />
</Route>
<Route path="/community">
<Community />
</Route>
<Route path="/challenges">
<Challenges />
</Route>
<Route path="/arcade">
<Arcade />
</Route>
<Route path="/stickerwall">
<StickerWall />
</Route>
<Route path="/competition">
<ContestPage />
</Route>
<Route path="/hackshackattack">
<HackShackAttack />
</Route>
<Route
exact
path="/replays"
render={props => <Replays {...props} />}
></Route>
<Route
exact
path="/replays/:replayId"
render={props => <Replays {...props} />}
></Route>
<Route path="/newslettertermsconditions">
<NewsletterTC />
</Route>
<Route path="/challengetermsconditions">
<ChallengeTC />
</Route>
<Route path="/newslettertermsconditions">
<NewsletterTC />
</Route>
<Route path="/ezmeral">
<Ezmeral />
</Route>
<Route
exact
path="/workshops"
render={props => <Workshops {...props} />}
>
</Route>
<Route
exact
path="/workshop/:replayId"
render={props => <Replays {...props} />}
>
</Route>
<Route
exact
path="/workshop/:replayId/finisher-badge"
render={props => <FinisherBadge {...props} />}
>
</Route>
<Route
exact
path="/workshops/:workshopId/special-badge"
render={props => <SpecialBadge {...props} />}
></Route>
<Route path="/workshoptermsconditions">
<WorkshopTC />
</Route>
<Route path="/treasurehunttermsconditions">
<TreasureHuntTC />
</Route>
</Switch>
</Router>
</Grommet>
);
}