Last active
November 20, 2019 12:30
-
-
Save akoserwal/b08908740c6c12f702de08cf5d9ca4e5 to your computer and use it in GitHub Desktop.
react-quarkus-integration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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