import { Component, linkEvent } from 'inferno'; import { Subscription } from "rxjs"; import { retryWhen, delay, take } from 'rxjs/operators'; import { PostForm, Post, PostResponse, UserOperation, Community, ListCommunitiesResponse } from '../interfaces'; import { WebSocketService, UserService } from '../services'; import { msgOp } from '../utils'; interface State { postForm: PostForm; communities: Array; } export class CreatePost extends Component { private subscription: Subscription; private emptyState: State = { postForm: { name: null, auth: null, community_id: null }, communities: [] } constructor(props, context) { super(props, context); this.state = this.emptyState; this.subscription = WebSocketService.Instance.subject .pipe(retryWhen(errors => errors.pipe(delay(3000), take(10)))) .subscribe( (msg) => this.parseMessage(msg), (err) => console.error(err), () => console.log('complete') ); WebSocketService.Instance.listCommunities(); } componentWillUnmount() { this.subscription.unsubscribe(); } render() { return (
{this.postForm()}
) } postForm() { return (

Create a Post