summaryrefslogtreecommitdiffstats
path: root/ui/src/components/create-post.tsx
diff options
context:
space:
mode:
authorDessalines <tyhou13@gmx.com>2019-08-22 16:13:26 -0700
committerDessalines <tyhou13@gmx.com>2019-08-22 16:13:26 -0700
commit20fec100b5c0d99f71e7e38c219f39686b990938 (patch)
tree2efceee2a1ff00bc642b6b106e5124ec5a9e3cba /ui/src/components/create-post.tsx
parent23150946d8f74a288765e2028dbf2f5545366c87 (diff)
Cross posting working.
Diffstat (limited to 'ui/src/components/create-post.tsx')
-rw-r--r--ui/src/components/create-post.tsx15
1 files changed, 14 insertions, 1 deletions
diff --git a/ui/src/components/create-post.tsx b/ui/src/components/create-post.tsx
index dd93a3c5..3e00bd80 100644
--- a/ui/src/components/create-post.tsx
+++ b/ui/src/components/create-post.tsx
@@ -1,6 +1,7 @@
import { Component } from 'inferno';
import { PostForm } from './post-form';
import { WebSocketService } from '../services';
+import { PostFormParams } from '../interfaces';
import { i18n } from '../i18next';
import { T } from 'inferno-i18next';
@@ -21,13 +22,25 @@ export class CreatePost extends Component<any, any> {
<div class="row">
<div class="col-12 col-lg-6 offset-lg-3 mb-4">
<h5><T i18nKey="create_post">#</T></h5>
- <PostForm onCreate={this.handlePostCreate} prevCommunityName={this.prevCommunityName} />
+ <PostForm onCreate={this.handlePostCreate} params={this.params} />
</div>
</div>
</div>
)
}
+ get params(): PostFormParams {
+ let urlParams = new URLSearchParams(this.props.location.search);
+ let params: PostFormParams = {
+ name: urlParams.get("name"),
+ community: urlParams.get("community") || this.prevCommunityName,
+ body: urlParams.get("body"),
+ url: urlParams.get("url"),
+ };
+
+ return params;
+ }
+
get prevCommunityName(): string {
if (this.props.match.params.name) {
return this.props.match.params.name;