diff options
author | Dessalines <tyhou13@gmx.com> | 2019-04-25 14:52:18 -0700 |
---|---|---|
committer | Dessalines <tyhou13@gmx.com> | 2019-04-25 14:52:18 -0700 |
commit | e4532aa1cb19decb5f57fca13ca20aae3e1e0a1e (patch) | |
tree | 8e053b3843acddfa3c36b593e3239d0fd6e38e73 /ui/src/components/community.tsx | |
parent | fdc5a23f2ac2d166a11fe2eb0670c97a16122835 (diff) |
Adding /f/ and /u/ in links now.
- Fixes #102
Diffstat (limited to 'ui/src/components/community.tsx')
-rw-r--r-- | ui/src/components/community.tsx | 11 |
1 files changed, 9 insertions, 2 deletions
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 |