clean action store

This commit is contained in:
vincent 2020-03-28 10:45:15 +01:00
parent 6ea99fb974
commit c344dd2316

View File

@ -8,30 +8,7 @@ import { isValidJwt, EventBus } from '../utils';
Vue.use(Vuex); Vue.use(Vuex);
const actions = { const actions = {
// asynchronous operations // asynchronous operations
getchaine(context, { num }) {
return fetchchaine(num)
.then((res) => {
if (res.status === 200) {
context.dispatch('getemission', { chaine: num, name: res.data });
} else {
context.commit('push_chaine', { chaine: num, name: res.data });
}
})
.catch((error) => {
// eslint-disable-next-line
console.error(error);
});
},
getemission(context, { chaine, name }) {
return fetchemission(chaine)
.then((resEmission) => {
context.commit('push_chaine', { chaine, name, emission: resEmission.data });
})
.catch((error) => {
context.commit('push_chaine', { chaine, name });
console.error(error);
});
},
setStorename(context, userData) { setStorename(context, userData) {
context.commit('setUserData', { userData }); context.commit('setUserData', { userData });
}, },