import { h, Component } from 'preact'; // import PropTypes from 'prop-types'; import { BrowserRouter, Route } from 'react-router-dom' import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; import { Redirect } from 'react-router-dom'; import Login from './login.component'; import Logout from './logout.component'; import Signup from './signup.component'; import { randint } from '../util/math' class AuthGate extends Component { render(){ if (this.props.auth.isAuthenticated) return children return (
) } componentDidMount(){ document.querySelector('.spinfx').style.backgroundImage = 'linear-gradient(' + (randint(40)-5) + 'deg, #fde, #ffe)' } } const mapStateToProps = (state) => ({ auth: state.auth }); const mapDispatchToProps = (dispatch) => ({ }); export default connect(mapStateToProps, mapDispatchToProps)(AuthGate);