Skip to content
This repository has been archived by the owner on Jul 9, 2019. It is now read-only.

Commit

Permalink
change how like and repost syndication is passed to the request so th…
Browse files Browse the repository at this point in the history
…at the post cards do not require to connect to the store and therefore work on the map
  • Loading branch information
grantcodes committed Nov 19, 2017
1 parent 6cf510f commit 6e7fb96
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
14 changes: 4 additions & 10 deletions src/components/card.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,14 @@ class TogetherCard extends React.Component {

handleLike(e) {
const url = this.props.post.url;
indieActions.like(url, this.props.likeSyndication)
indieActions.like(url)
.then(() => alert('successful like'))
.catch(() => alert('error liking'));
}

handleRepost(e) {
const url = this.props.post.url;
indieActions.repost(url, this.props.repostSyndication)
indieActions.repost(url)
.then(() => alert('successful repost'))
.catch(() => alert('error repost'));
}
Expand Down Expand Up @@ -318,11 +318,5 @@ TogetherCard.propTypes = {
// }, dispatch);
// }

function mapStateToProps(state, props) {
return {
likeSyndication: state.settings.get('likeSyndication'),
repostSyndication: state.settings.get('repostSyndication'),
};
}

export default connect(mapStateToProps, null)(withStyles(styles)(TogetherCard));
// export default connect(null, mapDispatchToProps)(withStyles(styles)(TogetherCard));
export default withStyles(styles)(TogetherCard);
10 changes: 6 additions & 4 deletions src/modules/indie-actions.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,30 @@
import micropubApi from './micropub-api';

export function like(url, syndication = []) {
export function like(url) {
let mf = {
type: ['h-entry'],
properties: {
'like-of': [url],
},
};
if (syndication.length > 0) {
const syndication = localStorage.getItem('together-setting-likeSyndication');
if (syndication && syndication.length > 0) {
mf.properties['mp-syndicate-to'] = syndication;
}
return micropubApi('create', {
param: mf,
});
}

export function repost(url, syndication = []) {
export function repost(url) {
let mf = {
type: ['h-entry'],
properties: {
'repost-of': [url],
},
};
if (syndication.length > 0) {
const syndication = localStorage.getItem('together-setting-repostSyndication');
if (syndication && syndication.length > 0) {
mf.properties['mp-syndicate-to'] = syndication;
}
return micropubApi('create', {
Expand Down

0 comments on commit 6e7fb96

Please sign in to comment.