1 import { Component } from 'inferno';
2 import { PrivateMessageForm } from './private-message-form';
3 import { WebSocketService } from '../services';
4 import { PrivateMessageFormParams } from '../interfaces';
5 import { toast } from '../utils';
6 import { i18n } from '../i18next';
8 export class CreatePrivateMessage extends Component<any, any> {
9 constructor(props: any, context: any) {
10 super(props, context);
11 this.handlePrivateMessageCreate = this.handlePrivateMessageCreate.bind(
17 document.title = `${i18n.t('create_private_message')} - ${
18 WebSocketService.Instance.site.name
24 <div class="container">
26 <div class="col-12 col-lg-6 offset-lg-3 mb-4">
27 <h5>{i18n.t('create_private_message')}</h5>
29 onCreate={this.handlePrivateMessageCreate}
38 get params(): PrivateMessageFormParams {
39 let urlParams = new URLSearchParams(this.props.location.search);
40 let params: PrivateMessageFormParams = {
41 recipient_id: Number(urlParams.get('recipient_id')),
47 handlePrivateMessageCreate() {
48 toast(i18n.t('message_sent'));
50 // Navigate to the front
51 this.props.history.push(`/`);