import UserLoggedService from '@/services/resources/UserLoggedService';
const service = UserLoggedService.build();

import router from '@/router/index'

export default {
    userRequest: ({ commit, dispatch }) => {


        service.get('')
            .then((resp) => {
                commit('userSuccess', resp);
                dispatch('redirectUserToHome')
            })
            .catch((err) => {
                commit('userError');
                // if resp is unauthorized, logout, to
               // dispatch('authLogout')
            });



    },
    redirectUserToHome: (context) => {
        console.log("Passou");
       console.log(context.state.user.show_tour);
if(context.state.user.show_tour){
    router.push('/tour');
    return;
}

        router.push('/');

    }
}