summaryrefslogtreecommitdiffstats
path: root/ui/src/components/create-post.tsx
diff options
context:
space:
mode:
authorDessalines <tyhou13@gmx.com>2019-03-22 18:42:57 -0700
committerDessalines <tyhou13@gmx.com>2019-03-22 18:42:57 -0700
commite570c70701e1c66dad12bef76821f6d94c717a02 (patch)
tree070d5ba322226acd5fe0d0a7757cb936462ab2ff /ui/src/components/create-post.tsx
parent816aa0b15f3766e340d8722f03e8b3a7633ab6fb (diff)
Adding login and Register
- Login and Register mostly working. - Starting to work on creating communities.
Diffstat (limited to 'ui/src/components/create-post.tsx')
-rw-r--r--ui/src/components/create-post.tsx57
1 files changed, 57 insertions, 0 deletions
diff --git a/ui/src/components/create-post.tsx b/ui/src/components/create-post.tsx
new file mode 100644
index 00000000..bb6e60e2
--- /dev/null
+++ b/ui/src/components/create-post.tsx
@@ -0,0 +1,57 @@
+import { Component, linkEvent } from 'inferno';
+
+import { LoginForm, PostForm, UserOperation } from '../interfaces';
+import { WebSocketService, UserService } from '../services';
+import { msgOp } from '../utils';
+
+interface State {
+ postForm: PostForm;
+}
+
+let emptyState: State = {
+ postForm: {
+ name: null,
+ url: null,
+ attributed_to: null
+ }
+}
+
+export class CreatePost extends Component<any, State> {
+
+ constructor(props, context) {
+ super(props, context);
+
+ this.state = emptyState;
+
+ WebSocketService.Instance.subject.subscribe(
+ (msg) => this.parseMessage(msg),
+ (err) => console.error(err),
+ () => console.log('complete')
+ );
+ }
+
+
+ render() {
+ return (
+ <div class="container">
+ <div class="row">
+ <div class="col-12 col-lg-6 mb-4">
+ create post
+ {/* {this.postForm()} */}
+ </div>
+ </div>
+ </div>
+ )
+ }
+
+ parseMessage(msg: any) {
+ console.log(msg);
+ let op: UserOperation = msgOp(msg);
+ if (msg.error) {
+ alert(msg.error);
+ return;
+ } else {
+ }
+ }
+
+}