summaryrefslogtreecommitdiffstats
path: root/ui/src/components/post-listing.tsx
diff options
context:
space:
mode:
authorDessalines <dessalines@users.noreply.github.com>2020-07-09 20:03:47 -0400
committerGitHub <noreply@github.com>2020-07-09 20:03:47 -0400
commit50e6d81d0b40e1d9caa0db83d20026adf3aef631 (patch)
tree78d3c0770ec4508dbc6c565372e93ddf8c577634 /ui/src/components/post-listing.tsx
parent85c07e7154c82e5b387bb6a02aae70645cf1d8e0 (diff)
Redirect to login page for votes, comments, pages, etc. Fixes #849 (#926)
Diffstat (limited to 'ui/src/components/post-listing.tsx')
-rw-r--r--ui/src/components/post-listing.tsx9
1 files changed, 9 insertions, 0 deletions
diff --git a/ui/src/components/post-listing.tsx b/ui/src/components/post-listing.tsx
index fa2a078e..418fe7b4 100644
--- a/ui/src/components/post-listing.tsx
+++ b/ui/src/components/post-listing.tsx
@@ -33,6 +33,7 @@ import {
setupTippy,
hostname,
previewLines,
+ toast,
} from '../utils';
import { i18n } from '../i18next';
@@ -1032,6 +1033,10 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
}
handlePostLike(i: PostListing) {
+ if (!UserService.Instance.user) {
+ this.context.router.history.push(`/login`);
+ }
+
let new_vote = i.state.my_vote == 1 ? 0 : 1;
if (i.state.my_vote == 1) {
@@ -1059,6 +1064,10 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
}
handlePostDisLike(i: PostListing) {
+ if (!UserService.Instance.user) {
+ this.context.router.history.push(`/login`);
+ }
+
let new_vote = i.state.my_vote == -1 ? 0 : -1;
if (i.state.my_vote == 1) {