I'm trying to fetch data from the OpenSea API but keep getting the following error:
FetchError: invalid json response body at https://api.opensea.io/api/v1/assets?format=json&order_direction=desc&owner=0x0f91b5a27c51dcad415eafb190e8235e987dcdcb reason: Unexpected token < in JSON at position 0
Here is my current code:
export async function getServerSideProps() {
const res = await fetch(`https://api.opensea.io/api/v1/assets?format=json&order_direction=desc&owner=0xc3b9d43afbb3dcc92e19703480f37070692494e1`)
const data = await res.json()
return { props: { data } }
}
const Page = ({data}) => {
return (
<>
{data.assets.map(asset => (
<p>{asset.id}</p>
))}
</>
)
}
export default Page