Created
January 15, 2019 22:23
-
-
Save luiscberrocal/6c20ac94e3946081a17b3e7504b1990d to your computer and use it in GitHub Desktop.
vuejs module template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const state = { | |
$STATE$: [], | |
} | |
const getters = { | |
$STATE$: state => { | |
return state.$STATE$; | |
}, | |
} | |
const mutations = { | |
set$STATE_UP$(state, $STATE$) { | |
state.$STATE$ = $STATE$; | |
}, | |
} | |
const actions = { | |
get$STATE_UP$({commit, getters}, $FILTER_VAL$) { | |
const JWTToken = getters.jwt; | |
const headers = {headers: {"Authorization": `Bearer ${JWTToken}`}} | |
axios.get(`/my/url/${$FILTER_VAL$}`, headers) | |
.then((response) => { | |
console.log(response.data); | |
commit('set$STATE_UP$', response.data); | |
}) | |
.catch((error) => { | |
console.log(error) | |
}) | |
}, | |
} | |
export default { | |
state, | |
mutations, | |
actions, | |
getters | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment