You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

37 lines
676 B

import RoleService from '@/services/role.service'
export const state = () => ({
items: [],
loading: false
})
export const getters = {
roles(state) {
return state.items
}
}
export const mutations = {
setRoleList(state, payload) {
state.items = payload
},
setLoading(state, payload) {
state.loading = payload
}
}
export const actions = {
getRoleList({ commit }) {
commit('setLoading', true)
return RoleService.getRoleList()
.then((response) => {
commit('setRoleList', response.data)
})
.catch((error) => {
alert(error)
})
.finally(() => {
commit('setLoading', false)
})
}
}