Skip to content
This repository was archived by the owner on Apr 5, 2020. It is now read-only.

Commit 2ed07a2

Browse files
committed
reusing action definition in action call
1 parent 91d4909 commit 2ed07a2

File tree

3 files changed

+15
-19
lines changed

3 files changed

+15
-19
lines changed

src/components/Pages/Card/Edit.js

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { replace } from 'react-router-redux'
55
import APIClient from '../../../http/requests'
66
import Editor from "../../Editor/Editor"
77
import s from '../../Editor/styles/content-tools.scss';
8-
8+
import { updateSnackbar } from "../../../redux/actions/notification";
99
// import LatinCardTemplate from '../Templates/Cards/LatinCardTemplate'
1010
// import BasicCardTemplate from '../Templates/Cards/BasicCardTemplate'
1111
import Card from './Card';
@@ -258,20 +258,12 @@ class CardEdit extends React.Component {
258258
}
259259
}
260260

261-
const mapDispatchToProps = (dispatch) => {
262-
return {
263-
updateSnackbar: (show, header, content, notificationType) => {
264-
dispatch ({
265-
type: 'UPDATE_SNACKBAR',
266-
show,
267-
header,
268-
content,
269-
notificationType
270-
})
271-
},
272-
dispatch
273-
}
274-
}
261+
const mapDispatchToProps = (dispatch) => ({
262+
updateSnackbar: function(show, header, content, notificationType) {
263+
dispatch(updateSnackbar(show, header, content, notificationType));
264+
},
265+
dispatch
266+
});
275267

276268
export default withStyles(s)(connect(
277269
null,

src/components/Pages/Card/SwipableCard.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ import React from 'react';
22
import s from './Card.scss'
33
import withStyles from 'isomorphic-style-loader/lib/withStyles';
44

5+
const minTravelPct = 0.35;
56
const cardStyle = {
67
transform: 'translateX(0px)',
78
willChange: 'transform',
8-
opacity: 1
9-
}
10-
const minTravelPct = 0.35;
9+
opacity: 1,
10+
};
1111

1212
class SwipableCard extends React.Component {
1313

src/redux/actions/notification.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export function updateSnackbar(show, header, content, notificationType) {
1+
function updateSnackbar(show, header, content, notificationType) {
22
return {
33
type: 'UPDATE_SNACKBAR',
44
show,
@@ -7,3 +7,7 @@ export function updateSnackbar(show, header, content, notificationType) {
77
notificationType,
88
};
99
}
10+
11+
export {
12+
updateSnackbar,
13+
};

0 commit comments

Comments
 (0)