mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-03 16:38:22 +03:00
Cleanup
no issue - Extract root div id so its easy to change it in one place in future - Add stripe load method - Extract all initial non-ui handling to setup method
This commit is contained in:
parent
9cf8e0e435
commit
a9a083f2f1
@ -4,10 +4,11 @@ import './index.css';
|
||||
import App from './App';
|
||||
|
||||
const handleDataAttributes = require('./data-attributes');
|
||||
const ROOT_DIV_ID = 'ghost-membersjs-root';
|
||||
|
||||
function addRootDiv() {
|
||||
const elem = document.createElement('div');
|
||||
elem.id = 'ghost-membersjs-root';
|
||||
elem.id = ROOT_DIV_ID;
|
||||
document.body.appendChild(elem);
|
||||
}
|
||||
|
||||
@ -33,15 +34,20 @@ function handleTokenUrl() {
|
||||
}
|
||||
}
|
||||
|
||||
function init() {
|
||||
function setup() {
|
||||
loadStripe();
|
||||
addRootDiv();
|
||||
handleDataAttributes({siteUrl: window.location.origin});
|
||||
handleTokenUrl();
|
||||
}
|
||||
|
||||
function init() {
|
||||
setup();
|
||||
ReactDOM.render(
|
||||
<React.StrictMode>
|
||||
<App />
|
||||
</React.StrictMode>,
|
||||
document.getElementById('ghost-membersjs-root')
|
||||
document.getElementById(ROOT_DIV_ID)
|
||||
);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user