import { Component, linkEvent } from 'inferno'; import { Subscription } from "rxjs"; import { retryWhen, delay, take } from 'rxjs/operators'; import { CommunityForm, UserOperation, Category, ListCategoriesResponse } from '../interfaces'; import { WebSocketService, UserService } from '../services'; import { msgOp } from '../utils'; import { Community } from '../interfaces'; interface State { communityForm: CommunityForm; categories: Array; } export class CreateCommunity extends Component { private subscription: Subscription; private emptyState: State = { communityForm: { name: null, title: null, category_id: null }, categories: [] } 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.listCategories(); } componentWillUnmount() { this.subscription.unsubscribe(); } render() { return (
{this.communityForm()}
) } communityForm() { return (

Create Forum