mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-25 02:31:59 -05:00
Initialized existing members.js data attribute handling
refs https://github.com/TryGhost/members.js/issues/32 - Inits data attribute handling from the copied over members.js file from core - Uses `window.location.origin` as site url for api calls in data attribute handling
This commit is contained in:
parent
514e022520
commit
fc75d9881d
2 changed files with 5 additions and 0 deletions
|
@ -1,3 +1,5 @@
|
|||
/* eslint-disable no-console */
|
||||
|
||||
function handleDataAttributes({siteUrl}) {
|
||||
Array.prototype.forEach.call(document.querySelectorAll('form[data-members-form]'), function (form) {
|
||||
let errorEl = form.querySelector('[data-members-error]');
|
||||
|
|
|
@ -3,6 +3,8 @@ import ReactDOM from 'react-dom';
|
|||
import './index.css';
|
||||
import App from './App';
|
||||
|
||||
const handleDataAttributes = require('./data-attributes');
|
||||
|
||||
function addRootDiv() {
|
||||
const elem = document.createElement('div');
|
||||
elem.id = 'ghost-membersjs-root';
|
||||
|
@ -19,6 +21,7 @@ function handleTokenUrl() {
|
|||
|
||||
function init() {
|
||||
addRootDiv();
|
||||
handleDataAttributes({siteUrl: window.location.origin});
|
||||
handleTokenUrl();
|
||||
ReactDOM.render(
|
||||
<React.StrictMode>
|
||||
|
|
Loading…
Add table
Reference in a new issue