resources/js/store/moduels/auth.js
//get the user by the token
get the user by the token
get the user by the token
async fetchUser({commit}){
            try{
               const {data} = await axios.get('/api/v1/auth/user')
                commit(types.FETCH_USER_SUCCESS,{user:data})
            }catch(error){
                commit(types.FETCH_USER_FAILURE)
            }
    }
async fetchUser ( { commit } ) { try { const { data } = await axios . get ( '/api/v1/auth/user' ) commit ( types . FETCH_USER_SUCCESS , { user : data } ) } catch ( error ) { commit ( types . FETCH_USER_FAILURE ) } }
get the user by the token
get the user by the token