]> Untitled Git - lemmy-ui.git/commitdiff
Redirect inbox to login. Fixes #105
authorDessalines <tyhou13@gmx.com>
Tue, 15 Dec 2020 23:43:35 +0000 (18:43 -0500)
committerDessalines <tyhou13@gmx.com>
Tue, 15 Dec 2020 23:43:35 +0000 (18:43 -0500)
src/shared/components/inbox.tsx

index 70feb4bed767c1fd49e5ce2b803c89df27efee01..04eb0431ecf1e8d65059175e945650adca614dfe 100644 (file)
@@ -87,6 +87,11 @@ export class Inbox extends Component<any, InboxState> {
     this.state = this.emptyState;
     this.handleSortChange = this.handleSortChange.bind(this);
 
+    if (!UserService.Instance.user && isBrowser()) {
+      toast(i18n.t('not_logged_in'), 'danger');
+      this.context.router.history.push(`/login`);
+    }
+
     this.parseMessage = this.parseMessage.bind(this);
     this.subscription = wsSubscribe(this.parseMessage);