Explicit call vuex actions in the `.vue` component detach/ready function
<p>I'm trying on vue-js and vuex on my project.</p>

<p>I've defined a <code>store.js</code>:</p>

<pre><code>import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex);

const state = {
    user: {}
};

const mutations = {
    SET_CURRENT_USER (state, data) {
        state.user = data;
    }
};

export default new Vuex.Store({
    state,
    mutations
});
</code></pre>

<p>And my <code>actions.js</code>:</p>

<pre><code>export const readCurrentUser = function({dispatch, state}) {
    let api = require('../api/resources');
    api.User.get({
        action: 'current'
    }).then(function(response) {
        dispatch('SET_CURRENT_USER', response.data);
    });
};
</code></pre>

<p>And then, so in my <code>App.vue</code> component:</p>

<pre><code>&lt;template&gt;
    &lt;a @click="readCurrentUser"&gt;read current user&lt;/a&gt;
&lt;/template&gt;

&lt;script&gt;
    import store from '../vuex/store'
    import { readCurrentUser } from '../vuex/actions'

    export default {
        replace: false,
        store: store,
        data: function () {
            return {
            };
        },
        vuex: {
            actions: {
                readCurrentUser: readCurrentUser
            }
        },
        attached: function() {
            // !!!!  HERE IS THE POINT !!!!
            // How can I trigger `readCurrentUser` action here?
        }
    }
&lt;/script&gt;
</code></pre>

<p>I the above case, when I click on the <code>&lt;a @click="readCurrentUser"&gt;</code> the action was fired as expected.</p>

<p>But I want the action trigger on every time the app attached, how can I do this?</p>