mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-28 16:38:10 +00:00
Add preventDefaults to stop form submits on likes. Fixes #153
This commit is contained in:
parent
7d8f1a1ced
commit
398cdf682c
|
@ -882,7 +882,8 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
|
||||||
this.setState(this.state);
|
this.setState(this.state);
|
||||||
}
|
}
|
||||||
|
|
||||||
handleCommentUpvote(i: CommentNodeI) {
|
handleCommentUpvote(i: CommentNodeI, event: any) {
|
||||||
|
event.preventDefault();
|
||||||
let new_vote = this.state.my_vote == 1 ? 0 : 1;
|
let new_vote = this.state.my_vote == 1 ? 0 : 1;
|
||||||
|
|
||||||
if (this.state.my_vote == 1) {
|
if (this.state.my_vote == 1) {
|
||||||
|
@ -910,7 +911,8 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
|
||||||
setupTippy();
|
setupTippy();
|
||||||
}
|
}
|
||||||
|
|
||||||
handleCommentDownvote(i: CommentNodeI) {
|
handleCommentDownvote(i: CommentNodeI, event: any) {
|
||||||
|
event.preventDefault();
|
||||||
let new_vote = this.state.my_vote == -1 ? 0 : -1;
|
let new_vote = this.state.my_vote == -1 ? 0 : -1;
|
||||||
|
|
||||||
if (this.state.my_vote == 1) {
|
if (this.state.my_vote == 1) {
|
||||||
|
|
|
@ -1155,7 +1155,8 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
handlePostLike(i: PostListing) {
|
handlePostLike(i: PostListing, event: any) {
|
||||||
|
event.preventDefault();
|
||||||
if (!UserService.Instance.user) {
|
if (!UserService.Instance.user) {
|
||||||
this.context.router.history.push(`/login`);
|
this.context.router.history.push(`/login`);
|
||||||
}
|
}
|
||||||
|
@ -1187,7 +1188,8 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
|
||||||
setupTippy();
|
setupTippy();
|
||||||
}
|
}
|
||||||
|
|
||||||
handlePostDisLike(i: PostListing) {
|
handlePostDisLike(i: PostListing, event: any) {
|
||||||
|
event.preventDefault();
|
||||||
if (!UserService.Instance.user) {
|
if (!UserService.Instance.user) {
|
||||||
this.context.router.history.push(`/login`);
|
this.context.router.history.push(`/login`);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue