32 lines
640 B
JavaScript
Vendored
32 lines
640 B
JavaScript
Vendored
const state = {
|
|
isAuthenticated: false,
|
|
role_id: null,
|
|
grupo_de_compra: null,
|
|
};
|
|
|
|
const mutations = {
|
|
SET_SESSION(state, { role_id, grupo_de_compra, is_authenticated }) {
|
|
state.isAuthenticated = is_authenticated;
|
|
state.role_id = role_id;
|
|
state.grupo_de_compra = grupo_de_compra;
|
|
|
|
console.log(state);
|
|
},
|
|
};
|
|
|
|
const actions = {
|
|
async fetchSession({ commit }) {
|
|
const response = await axios.get('/session');
|
|
commit('SET_SESSION', response.data);
|
|
},
|
|
};
|
|
|
|
const getters = {};
|
|
|
|
export default {
|
|
namespaced: true,
|
|
state,
|
|
mutations,
|
|
actions,
|
|
getters,
|
|
};
|