File tree Expand file tree Collapse file tree 4 files changed +46
-19
lines changed
Expand file tree Collapse file tree 4 files changed +46
-19
lines changed Original file line number Diff line number Diff line change @@ -514,10 +514,34 @@ Paragon components can have different behavior in the MFE environment. `example`
514514
515515Steps to install the ` example ` app.
516516
517+ To set up the example app with a local Tutor installation, you'll need to configure a Tutor plugin to handle CORS settings
518+
519+ Prerequisites.
520+
521+ Before running the example app, ensure you have a local Tutor installation configured.
522+ 1 . Create a new file (i.e. ` paragon-example-app.py ` ) in your tutor plugins folder (` tutor plugins printroot ` to get the path).
523+ 2 . Add the following content to the paragon-example-app.py file:
524+ ```
525+ from tutor import hooks
526+
527+ hooks.Filters.ENV_PATCHES.add_item(
528+ (
529+ "openedx-lms-development-settings",
530+ """
531+ CORS_ORIGIN_WHITELIST.append("http://localhost:8080")
532+ LOGIN_REDIRECT_WHITELIST.append("http://localhost:8080")
533+ CSRF_TRUSTED_ORIGINS.append("http://localhost:8080")
534+ """
535+ )
536+ )
537+ ```
538+ 3 . Enable the plugin: ` tutor plugins enable paragon-example-app `
539+ 4 . Apply configuration changes: ` tutor config save ` && ` tutor dev restart `
540+
541+ Running the Example App:
5175421 . ` npm install ` to install dependencies.
518- 2 . Launch any devstack. It is required for MFE to login into the system and set up configs.
519- 3 . ` npm run start-example-mfe ` to start the app.
520- 4 . Go to the ` example/src/MyComponent.jsx ` and use Paragon components inside the MFE environment.
543+ 2 . ` npm run example:start ` to start the app.
544+ 3 . Go to the ` example/src/MyComponent.jsx ` and use Paragon components inside the MFE environment.
521545
522546## Semantic Release
523547
Original file line number Diff line number Diff line change 1- NODE_ENV = ' development'
2- REFRESH_ACCESS_TOKEN_ENDPOINT = ' http://localhost:18000/login_refresh'
3- LMS_BASE_URL = ' http://localhost:18000'
4- ACCESS_TOKEN_COOKIE_NAME = ' edx-jwt-cookie-header-payload'
1+ NODE_ENV = development
2+ REFRESH_ACCESS_TOKEN_ENDPOINT = http://local.openedx.io:8000/login_refresh
3+ LMS_BASE_URL = http://local.openedx.io:8000
4+ ACCESS_TOKEN_COOKIE_NAME = edx-jwt-cookie-header-payload
5+ BASE_URL = http://local.openedx.io:8080
6+ LOGIN_URL = http://local.openedx.io:8000/login
7+ LOGOUT_URL = http://local.openedx.io:8000/logout
8+ CSRF_TOKEN_API_PATH = /csrf/api/v1/token
Original file line number Diff line number Diff line change 11<!doctype html>
22< html lang ="en-us ">
33< head >
4- < title > Example</ title >
4+ < title > Paragon Example</ title >
55 < meta charset ="utf-8 ">
66 < meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
77</ head >
Original file line number Diff line number Diff line change 1- import React from 'react' ;
2- import ReactDOM from 'react-dom' ;
1+ import { createRoot } from 'react-dom/client' ;
32import {
43 AppProvider ,
54 ErrorPage ,
6- PageRoute ,
5+ PageWrap ,
76} from '@edx/frontend-platform/react' ;
87import { APP_INIT_ERROR , APP_READY , initialize } from '@edx/frontend-platform' ;
98import { subscribe } from '@edx/frontend-platform/pubSub' ;
109import MyComponent from './MyComponent' ;
1110
1211import './index.scss' ;
1312
13+ const container = document . getElementById ( 'root' ) ;
14+ const root = createRoot ( container ) ;
15+
1416subscribe ( APP_READY , ( ) => {
15- ReactDOM . render (
17+ root . render (
1618 < AppProvider >
17- < PageRoute
18- exact
19- path = "/"
20- component = { MyComponent }
21- />
19+ < PageWrap >
20+ < MyComponent />
21+ </ PageWrap >
2222 </ AppProvider > ,
23- document . getElementById ( 'root' ) ,
2423 ) ;
2524} ) ;
2625
2726subscribe ( APP_INIT_ERROR , ( error ) => {
28- ReactDOM . render ( < ErrorPage message = { error . message } /> , document . getElementById ( 'root' ) ) ;
27+ root . render ( < ErrorPage message = { error . message } /> ) ;
2928} ) ;
3029
3130initialize ( {
You can’t perform that action at this time.
0 commit comments