import React from 'react';
import PropTypes from 'prop-types';
import fetch from 'isomorphic-unfetch';
import { URLSearchParams } from 'url';
import Layout from '../components/template/Layout';
global.URLSearchParams = URLSearchParams;
const Test = () => (
<Layout classProp="frontpage">
{/* <FrontMainComponent data={JSONdata} /> */}
</Layout>
);
Test.getInitialProps = async () => {
const formData = new URLSearchParams();
formData.append('property_id', 1000168);
formData.append('type', 'm');
formData.append('field_prop_listing_type', 'sale');
const res = await fetch('https://jsondummy.com/posts', {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
body: formData,
});
const data = await res.json();
console.log(data);
};
export default Test;