import React from 'react'; import {render} from 'react-dom'; import {Router, Route, browserHistory, IndexRoute} from 'react-router'; import Api from './api'; import Home from './sites/home'; import Category from './sites/category'; import Auth from './sites/auth/auth'; import Header from './partials/header'; import Footer from './partials/footer'; class Flox extends React.Component { constructor() { super(); this.state = { logged: false }; this.checkLogin(); } render() { return (
{React.cloneElement(this.props.children, {logged: this.state.logged, checkLogin: this.checkLogin.bind(this)})}
); } checkLogin() { Api.checkLogin().then((value) => { this.setState({ logged: value.logged }) }); } } render(( window.scrollTo(0, 0)}> ), document.querySelector('.flox'));