{"size": 515, "ext": "js", "max_stars_repo_path": "src/components/firstVisitRedirect/index.js", "max_stars_repo_name": "kepennar/master-darija", "max_stars_repo_stars_event_min_datetime": "2017-08-06T11:44:35.000Z", "max_stars_repo_stars_event_max_datetime": "2020-05-20T09:47:27.000Z", "max_issues_repo_path": "src/components/firstVisitRedirect/index.js", "max_issues_repo_name": "namara25/master-darija", "max_issues_repo_issues_event_min_datetime": "2017-08-07T19:52:45.000Z", "max_issues_repo_issues_event_max_datetime": "2017-10-09T15:05:28.000Z", "max_forks_repo_path": "src/components/firstVisitRedirect/index.js", "max_forks_repo_name": "namara25/master-darija", "max_forks_repo_forks_event_min_datetime": "2017-10-08T03:45:34.000Z", "max_forks_repo_forks_event_max_datetime": "2017-10-10T15:02:28.000Z"}
{"max_stars_count": 6, "max_issues_count": 1, "max_forks_count": 2, "avg_line_length": 24.5238095238, "max_line_length": 70, "alphanum_fraction": 0.6485436893}
import { h, Component } from 'preact';
import { route as goTo } from 'preact-router';

const FIRSTIME_TOKEN = 'isFistTime';

export default class FirstVisitRedirect extends Component {
  componentWillMount() {
    if (typeof window !== 'undefined') {
      const isFirstTime = window.localStorage.getItem(FIRSTIME_TOKEN);
      if (isFirstTime === 'false') {
        goTo('/home');
      }
      window.localStorage.setItem(FIRSTIME_TOKEN, false);
    }
  }

  render({ children }) {
    return { children };
  }
}
