{"size": 740, "ext": "js", "max_stars_repo_path": "src/InitialApp.js", "max_stars_repo_name": "fbyrne/notebook-notes-app", "max_stars_repo_stars_event_min_datetime": "2020-10-02T13:30:06.000Z", "max_stars_repo_stars_event_max_datetime": "2020-10-02T13:30:06.000Z", "max_issues_repo_path": "src/InitialApp.js", "max_issues_repo_name": "fbyrne/notebook-notes-app", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/InitialApp.js", "max_forks_repo_name": "fbyrne/notebook-notes-app", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 25.5172413793, "max_line_length": 94, "alphanum_fraction": 0.5878378378}
import React, { useEffect, useState } from 'react';

import SecuredApp from './SecuredApp';

import { useAuthn } from './services/AuthenticationService'


function InitialApp() {
    const authn = useAuthn();
    const [authenticated, setAuthenticated] = useState(false);

    useEffect(() => {
        console.log("InitialApp.useEffect()")
        authn
            .signIn()
            .then((authenticated) => {
                setAuthenticated(authenticated);
            })
            .catch((err) => console.log(err));
    }, []);

    if(authenticated){
        return (<SecuredApp />);
    } else {
        return (<div>Attempting to Sign In, you will be redirected to a login shortly!</div>);
    }
};

export default InitialApp;