gopangolin / wp-reactivate

React boilerplate for WordPress plugins

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Accessing the WP Reactivate settings page throws error

jfrankdev opened this issue · comments

Visiting this directory /wp-admin/options-general.php?page=wp-reactivate on my local Wordpress install throws this error in the console:

Admin.jsx:16 Uncaught TypeError: Cannot read property 'api_url' of undefined at
Admin._this.getSetting (Admin.jsx:16)

The error is referring to this function:

  getSetting = () => {
    fetch(`${this.props.wpObject.api_url}settings`, {
      credentials: 'same-origin',
      method: 'GET',
      headers: {
        'Content-Type': 'application/json',
        'X-WP-Nonce': this.props.wpObject.api_nonce,
      },
    })
    .then(response => response.json())
    .then(
      (json) => this.setState({ settings: json.wpreactivate }),
      (err) => console.log('error', err)
    );
  };

Thanks for the bug report!

You can pull the latest master branch for the fix, or see it here - cedc817