{"size": 817, "ext": "js", "max_stars_repo_path": "ReactNative/src/action/SplashAction.js", "max_stars_repo_name": "instinctools/routine", "max_stars_repo_stars_event_min_datetime": "2020-06-01T07:20:46.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-03T08:42:04.000Z", "max_issues_repo_path": "ReactNative/src/action/SplashAction.js", "max_issues_repo_name": "instinctools/routine", "max_issues_repo_issues_event_min_datetime": "2020-06-01T08:42:11.000Z", "max_issues_repo_issues_event_max_datetime": "2020-09-29T07:48:26.000Z", "max_forks_repo_path": "ReactNative/src/action/SplashAction.js", "max_forks_repo_name": "instinctools/routine", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 4, "max_issues_count": 19, "max_forks_count": null, "avg_line_length": 26.3548387097, "max_line_length": 73, "alphanum_fraction": 0.5201958384}
import auth from "@react-native-firebase/auth";

const SplashAction = {
    Type: {
        SPLASH_AUTH_PROGRESS: `SPLASH_AUTH_PROGRESS`,
        SPLASH_AUTH_SUCCESS: `SPLASH_AUTH_SUCCESS`,
        SPLASH_AUTH_ERROR: `SPLASH_AUTH_ERROR`
    }
};

SplashAction.startAuth = () => {
    return (dispatch) => {
        dispatch({
            type: SplashAction.Type.SPLASH_AUTH_PROGRESS
        });
        return auth()
            .signInAnonymously()
            .then(()=>{
                //TODO workaround to prevent error after successful login
                setTimeout(function() {
                    dispatch({
                            type: SplashAction.Type.SPLASH_AUTH_SUCCESS
                        }
                    )
                }, 500);
            })
    }
};

export default SplashAction
