Funciones para toast y mostrar errores
This commit is contained in:
parent
571b02382e
commit
0dba210a6a
1 changed files with 15 additions and 1 deletions
16
resources/js/store/modules/ui.js
vendored
16
resources/js/store/modules/ui.js
vendored
|
@ -23,7 +23,21 @@ const actions = {
|
||||||
clickMiga({ dispatch }, { miga }) {
|
clickMiga({ dispatch }, { miga }) {
|
||||||
dispatch(miga.action, null, { root: true });
|
dispatch(miga.action, null, { root: true });
|
||||||
state.migas = dropWhile(state.migas.reverse(),(m => m.nombre !== miga.nombre)).reverse();
|
state.migas = dropWhile(state.migas.reverse(),(m => m.nombre !== miga.nombre)).reverse();
|
||||||
}
|
},
|
||||||
|
toast(_, { mensaje }) {
|
||||||
|
return window.bulmaToast.toast({
|
||||||
|
message: mensaje,
|
||||||
|
duration: 2000,
|
||||||
|
type: 'is-danger',
|
||||||
|
position: 'bottom-center',
|
||||||
|
});
|
||||||
|
},
|
||||||
|
error({ dispatch }, { error }) {
|
||||||
|
const errorMsg = error.response && error.response.data && error.response.data.message
|
||||||
|
? error.response.data.message
|
||||||
|
: error.message;
|
||||||
|
dispatch("toast", { mensaje: errorMsg });
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
Loading…
Add table
Reference in a new issue