From fbf108595a00a7c9db5984158e4b02cc345b68d1 Mon Sep 17 00:00:00 2001 From: Jan Tuomi Date: Fri, 31 Jan 2020 19:20:13 +0200 Subject: Initial commit --- frontend/src/App.js | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 frontend/src/App.js (limited to 'frontend/src/App.js') diff --git a/frontend/src/App.js b/frontend/src/App.js new file mode 100644 index 0000000..af2f99d --- /dev/null +++ b/frontend/src/App.js @@ -0,0 +1,34 @@ +import React, { useEffect } from 'react'; +import { Router } from '@reach/router'; + +import Login from './Login'; +import Home from './Home'; +import userState from './UserState'; +import './App.css'; +import axios from './axios'; + +const App = () => { + useEffect(() => { + const fetchUserInfo = async () => { + try { + const resp = await axios.get('/user'); + const { username } = resp.data; + userState.username = username; + } catch (err) { + console.error(err); + } + }; + fetchUserInfo(); + }, []); + + return ( +
+ + + + +
+ ); +}; + +export default App; -- cgit v1.3