Skip to content

Not working, no errors #12

Description

@allysonsouza

I've tried to use the component and had no errors but it didn't work. Are you guys still maintaining this or I'm missing something?

Here's my component code:

import React, { useState, useEffect, Suspense } from 'react';
import EmbedContainer from 'react-oembed-container';
import axios from '../../../../node_modules/axios/dist/axios.js';

const RealTime = () => {
	const [content, setContent] = useState('');

	useEffect(() => {
		const options = {
			url: wpApiSettings.root + 'wp/v2/custom-post-type/' + postTypeID,
			method: 'GET',
			headers: {
				'Accept': 'application/json',
				'Content-Type': 'application/json;charset=UTF-8'
			},
		};

		function requestPosts(options) {
			axios(options).then( response => {
				console.log( response );
				setContent( response.data.content.rendered );
			});
		    setTimeout(requestMoments, 20000, options);
		};

		requestPosts(options);
  	});

	return (
		<EmbedContainer markup={content}>
			<div dangerouslySetInnerHTML={{ __html: content }}></div>
		</EmbedContainer>
	)
}

export default RealTime;

Thanks in advance!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions