Question
Network request failed error in api calling
I am using below code for calling some external api in our plugin and getting error: Network request failed
Anyone kindly help to sort out this isue.
*********mainfeest.json***********
{
"id": "xyz",
"name": "xyz",
"version": "1.0.1",
"main": "index.html",
"manifestVersion": 5,
"icons": [
{
"width": 48,
"height": 48,
"path": "icons/plugin.png",
"scale": [1, 2],
"theme": ["darkest", "dark", "medium", "lightest", "light", "all"],
"species": ["pluginList"]
}
],
"requiredPermissions": {
"network": {
},
"clipboard": "readAndWrite",
"webview": {
"allow": "yes",
},
"launchProcess": {
"schemes": ["https", "slack"],
"extensions": [".xd", ".psd"]
}
}
}
**********common function*************:
async function fetchData(API) {
console.log("calling")
try {
const response = await fetch(API);
const data = await response.json();
console.log(data);
} catch (error) {
console.log('Error fetching data:', error);
}
}
************Calling function*************
API working when I put hostenty else getting error Network request failed
