Hi,
In theme app extension file I run JS code, where is fetch method:
(function () {
async function fetchBars() {
const response = await fetch("/apps/prapp/bars", {
method: "GET",
headers: {
"Content-Type": "application/json",
Accept: "application/json",
},
});
try {
const res = await response.json();
console.log(res);
} catch (error) {
console.log(error.message);
}
return response;
}
fetchBars();
})();
But instead data JSON, I get a HTML:
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8">
<meta name="author" content="ngrok">
<meta name="description" content="ngrok is the fastest way to put anything on the internet with a single command.">
<meta name="robots" content="noindex, nofollow">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link id="style" rel="stylesheet" href="https://cdn.ngrok.com/static/css/error.css">
<noscript>You are about to visit 735f-146-70-141-22.au.ngrok.io, served by 146.70.141.22. This website is served for free through ngrok.com. You should only visit this website if you trust whoever sent the link to you. (ERR_NGROK_6024)</noscript>
<script id="script" src="https://cdn.ngrok.com/static/js/error.js" type="text/javascript"></script>
</head>
<body id="ngrok">
<div id="root" data-payload="eyJjZG5CYXNlIjoiaHR0cHM6Ly9jZG4ubmdyb2suY29tLyIsImNvZGUiOiI2MDI0IiwiaG9zdHBvcnQiOiI3MzVmLTE0Ni03MC0xNDEtMjIuYXUubmdyb2suaW8iLCJtZXNzYWdlIjoiWW91IGFyZSBhYm91dCB0byB2aXNpdCA3MzVmLTE0Ni03MC0xNDEtMjIuYXUubmdyb2suaW8sIHNlcnZlZCBieSAxNDYuNzAuMTQxLjIyLiBUaGlzIHdlYnNpdGUgaXMgc2VydmVkIGZvciBmcmVlIHRocm91Z2ggbmdyb2suY29tLiBZb3Ugc2hvdWxkIG9ubHkgdmlzaXQgdGhpcyB3ZWJzaXRlIGlmIHlvdSB0cnVzdCB3aG9ldmVyIHNlbnQgdGhlIGxpbmsgdG8geW91LiIsInNlcnZpbmdJUCI6IjE0Ni43MC4xNDEuMjIiLCJ0aXRsZSI6Ik9LIn0="></div>
</body>
</html>
I use App proxy: https://prnt.sc/1oNgspv6FLd3
How can I fix it? My expectation is to get JSON data in the theme app extension JS file.


