From e4532aa1cb19decb5f57fca13ca20aae3e1e0a1e Mon Sep 17 00:00:00 2001
From: Dessalines <tyhou13@gmx.com>
Date: Thu, 25 Apr 2019 14:52:18 -0700
Subject: Adding /f/ and /u/ in links now.

- Fixes #102
---
 ui/src/components/community.tsx | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

(limited to 'ui/src/components/community.tsx')

diff --git a/ui/src/components/community.tsx b/ui/src/components/community.tsx
index f521d518..ba542582 100644
--- a/ui/src/components/community.tsx
+++ b/ui/src/components/community.tsx
@@ -10,6 +10,7 @@ import { msgOp } from '../utils';
 interface State {
   community: CommunityI;
   communityId: number;
+  communityName: string;
   moderators: Array<CommunityUser>;
   admins: Array<UserView>;
   loading: boolean;
@@ -36,6 +37,7 @@ export class Community extends Component<any, State> {
     moderators: [],
     admins: [],
     communityId: Number(this.props.match.params.id),
+    communityName: this.props.match.params.name,
     loading: true
   }
 
@@ -52,7 +54,12 @@ export class Community extends Component<any, State> {
         () => console.log('complete')
     );
 
-    WebSocketService.Instance.getCommunity(this.state.communityId);
+    if (this.state.communityId) {
+      WebSocketService.Instance.getCommunity(this.state.communityId);
+    } else if (this.state.communityName) {
+      WebSocketService.Instance.getCommunityByName(this.state.communityName);
+    }
+
   }
 
   componentWillUnmount() {
@@ -71,7 +78,7 @@ export class Community extends Component<any, State> {
               <small className="ml-2 text-muted font-italic">removed</small>
             }
           </h5>
-            <PostListings communityId={this.state.communityId} />
+          {this.state.community && <PostListings communityId={this.state.community.id} />}
           </div>
           <div class="col-12 col-md-3">
             <Sidebar 
-- 
cgit v1.2.3

