in services/app/frontend/src/App.js [23:45]
function App() {
const [data, setData] = React.useState(null);
React.useEffect(() => {
fetch("/homepage")
.then((res) => res.json())
.then((data) => setData(JSON.stringify(data)));
// mock app server error
const xhr = new XMLHttpRequest();
xhr.open('post', '/test');
xhr.send();
// mock apisix error
const apisix = new XMLHttpRequest();
apisix.open('post', '/test-apisix-404');
apisix.send();
}, []);
return (
<div className="App">
<p>{!data ? "Loading..." : data}</p>
</div>
);
}