// server.use(cookieParser());
server.get('/*', async (req, res) => {
- const activeRoute = routes.find(route => matchPath(req.url, route)) || {};
+ const activeRoute = routes.find(route => matchPath(req.path, route)) || {};
const context = {} as any;
let auth: string = IsomorphicCookie.load('jwt', req);
}
setupCommunities() {
- if (this.props.post) {
- this.state.postForm.community_id = this.props.post.community_id;
- } else if (this.props.params && this.props.params.community) {
- let foundCommunityId = this.props.communities.find(
- r => r.name == this.props.params.community
- ).id;
- this.state.postForm.community_id = foundCommunityId;
- } else {
- // By default, the null valued 'Select a Community'
- }
-
// Set up select searching
if (isBrowser()) {
let selectId: any = document.getElementById('post-community');
);
}
}
+
+ if (this.props.post) {
+ this.state.postForm.community_id = this.props.post.community_id;
+ } else if (this.props.params && this.props.params.community) {
+ let foundCommunityId = this.props.communities.find(
+ r => r.name == this.props.params.community
+ ).id;
+ this.state.postForm.community_id = foundCommunityId;
+ if (isBrowser()) {
+ this.choices.setChoiceByValue(
+ this.state.postForm.community_id.toString()
+ );
+ }
+ this.setState(this.state);
+ } else {
+ // By default, the null valued 'Select a Community'
+ }
}
parseMessage(msg: WebSocketJsonResponse) {