We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
import React, { useEffect, useState } from 'react'; import { Provider } from 'react-redux'; import 'regenerator-runtime/runtime'; import { AppProvider } from '@edx/frontend-platform/react'; import { configure as configureAuth, AxiosJwtAuthService, getAuthenticatedHttpClient, fetchAuthenticatedUser } from '@edx/frontend-platform/auth'; import { getConfig } from '@edx/frontend-platform/config'; import { configure as configureLogging, getLoggingService, NewRelicLoggingService, } from '@edx/frontend-platform/logging'; import { configure as configureAnalytics, SegmentAnalyticsService } from '@edx/frontend-platform/analytics'; import { configure as configureI18n, } from '@edx/frontend-platform/i18n' import store from './src/store'; // eslint-disable-next-line react/display-name,react/prop-types export default ({ children }) => { const [ready, setReady] = useState(false); useEffect(() => { configureLogging(NewRelicLoggingService, { config: getConfig(), }); configureAuth(AxiosJwtAuthService, { loggingService: getLoggingService(), config: getConfig(), }); // Analytics configureAnalytics(SegmentAnalyticsService, { config: getConfig(), loggingService: getLoggingService(), httpClient: getAuthenticatedHttpClient(), }); // Internationalization configureI18n({ messages: {}, config: getConfig(), loggingService: getLoggingService(), }); fetchAuthenticatedUser().then(() => { setReady(true); }) }, []); if (!ready) { return null; } return ( <AppProvider store={store}>{children}</AppProvider> ); }``` This class, when used in `wrapRootElement` allows for basic usage of frontend-platform services in a Gatsby-based project. The initialize function can't be used because it's async.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The text was updated successfully, but these errors were encountered: