Skip to content

Instantly share code, notes, and snippets.

@ntakouris
Created May 10, 2019 12:26
Show Gist options
  • Save ntakouris/e0242c021c02f3ba5ed85fa174e63367 to your computer and use it in GitHub Desktop.
Save ntakouris/e0242c021c02f3ba5ed85fa174e63367 to your computer and use it in GitHub Desktop.
import axios from 'axios'
import ApiRoutes from '@/api/ApiRoutes'
const state = {
nodeList: [],
}
const getters = {}
const actions = {
async getNodeList ({ commit }) {
const response = await axios.get(ApiRoutes.Nodes.GetAll)
const nodes = response.data
commit('setNodeList', nodes)
},
}
const mutations = {
setNodeList (state, nodeList) {
state.nodeList = nodeList
},
}
export default {
namespaced: true,
state,
getters,
actions,
mutations
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment