React front end for Wordpress API - Adding content.rendered Only secure origins are allowed

时间:2017-08-30 20:43:04

标签: wordpress api reactjs ssl https

Just as a preface, I am using create-react-app boiler plate.

I am trying to parse out a post from the wordpress API into a react component so I can extract all images and make them their own JSX objects. I need to have each post have its own on click method so I cant just use the dangerouslyaddHTML function in React.

Currently, I search through the string of json that had the rendered HTML from the WP content of each post and find all img tags. I then add then image src to an array and set this in my state.

However I am getting this error :

DOMException: Only secure origins are allowed

The site I have this currently hosted on it http://natalie.madeline-omoore.com/build/

The code for part of my component is below:

DECLARE @Passphrase NVARCHAR(Max) = 'testpassphrase'

SELECT Convert(NVARCHAR(Max), DecryptByPassphrase(@Passphrase, @Encrypted))

I am new to react so thank you!

1 个答案:

答案 0 :(得分:0)

这听起来像是create-react-app默认使用的“服务工作者”的问题

您可以通过将以下内容添加到index.js来注销工作程序:

setState

确保在调用registerServiceWorker()之后调用unregister()。

您可以在此处了解更多信息:https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md#making-a-progressive-web-app

祝你好运,编码愉快!