Skip to content

Instantly share code, notes, and snippets.

@akoserwal
Last active November 20, 2019 12:30
Show Gist options
  • Save akoserwal/b08908740c6c12f702de08cf5d9ca4e5 to your computer and use it in GitHub Desktop.
Save akoserwal/b08908740c6c12f702de08cf5d9ca4e5 to your computer and use it in GitHub Desktop.
react-quarkus-integration
function App() {
const [data, setData] = useState({ users: [] });
useEffect(() => {
const fetchData = async () => {
const result = await axios(
'http://127.0.0.1:8080/user', { headers: { "Authorization": "Bearer " + localStorage.getItem("react-token") } }
);
setData(result.data);
};
fetchData();
}, []);
return (
<div className="App">
<header className="App-header">
<h1>Secure React App</h1>
<div>
<img src={logo} className="App-logo" alt="logo" />
</div>
<div>
<h2>Response from Quarkus API: /user </h2>
<p>Name: {data.name}</p>
<p>Email:{data.email}</p>
</div>
</header>
</div>
);
}
export default App;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment