|
|
@@ -16,17 +16,22 @@ export const saveClase = ({clase}) => {
|
|
|
payload: clase
|
|
|
});
|
|
|
});
|
|
|
- }).catch( err => {
|
|
|
- console.log("caught", err);
|
|
|
});
|
|
|
};
|
|
|
}
|
|
|
|
|
|
export const deleteClase = ({clase}) => {
|
|
|
return (dispatch) => {
|
|
|
- dispatch({
|
|
|
- type: LS_CLASE_DELETE,
|
|
|
- payload: clase._id
|
|
|
+ ls.get('clases').then( (data) => {
|
|
|
+ const filtered = data.filter( c => {
|
|
|
+ return c._id !== clase._id
|
|
|
+ });
|
|
|
+ ls.save('clases', filtered ).then(() => {
|
|
|
+ dispatch({
|
|
|
+ type: LS_CLASE_DELETE,
|
|
|
+ payload: clase._id
|
|
|
+ });
|
|
|
+ });
|
|
|
});
|
|
|
}
|
|
|
}
|