I am fetching a simple API, and everything works fine when displaying in the console, but then I catch a very weird error in the Brave Browser console, and that's why I cannot display anything in html. I have one API that works just fine and another similar API that throws this error :
GET https://api.bscscan.com/api?module=stats&action=tokenCsupply&contractaddress=0xde301D6a2569aEfcFe271B9d98f318BAee1D30a4&apikey=E2JAJX6MAGAZUHSYIBZIEMKMNW9NZKPR7I
net::ERR_BLOCKED_BY_CLIENT
My code :
import Head from 'next/head'
import styles from '../styles/Home.module.css'
import {
bsctokendata
} from "../pages/bscdatanew/data";
import React, {
useEffect,
useState
} from "react";
import {
useRouter
} from "next/router";
export default function Test() {
let loco = async() => {
function apitest() {
//below is displaying weird error but in console all good
let bscbalance = 'https://api.bscscan.com/api?module=stats&action=tokenCsupply&contractaddress=0xde301D6a2569aEfcFe271B9d98f318BAee1D30a4&apikey=E2JAJX6MAGAZUHSYIBZIEMKMNW9NZKPR7I'
//below is working fine
// let bscbalance = 'https://api.bscscan.com/api?module=account&action=tokenbalance&contractaddress=0xde301D6a2569aEfcFe271B9d98f318BAee1D30a4&address=0x65d9cb422517127f1dd997a05274ab16264330b6&tag=latest&apikey=E2JAJX6MAGAZUHSYIBZIEMKMNW9NZKPR7I'
return bscbalance;
}
let url = await apitest();
const addressbalance = await fetch(url)
console.log(addressbalance)
const databal = await addressbalance.json();
console.log(databal)
}
loco()
return (
<div style={{ padding: 40 }}>
</div>
);
}
Here are 2 pictures of the console to show that the working api and the not working api have the same results in the console: