sqreen/vue-authentication-example

[Q] What is the reason to use list here [USER_REQUEST]

kiddten opened this issue · 1 comments

[USER_REQUEST]: ({commit, dispatch}) => {

Seems str is enough:

USER_REQUEST: ({commit, dispatch}) => {

Hey!

The exact value of USER_REQUEST can be used anywhere in your app though a $store.dispatch in this case.

This means that you want to have a single source of truth of this string.

In practice you want to do this:

import {USER_REQUEST} from 'foo/actions'

$store.dispatch(USER_REQUEST)

instead of

$store.dispatch('USER_REQUEST')

Hope it helped!