import { BrowserRouter, Link } from 'react-router-dom';
import styled from 'styled-components';

import GlobalStyles from './styles/GlobalStyles';
import RouteInfo from './RouteInfo';

import './i18n';

function App() {
	const isToken = sessionStorage.getItem('token') ? true : false;

	return (
		<BrowserRouter>
			<GlobalStyles />
			<ControllLink>{isToken ? <Link to="/main" /> : <Link to="/fail" />}</ControllLink>
			<RouteInfo />
		</BrowserRouter>
	);
}

export default App;

const ControllLink = styled.div`
	position: absolute;
`;
