import React, { Component } from "react"; import { Link, RouteComponentProps } from "react-router-dom"; import { Space, Breadcrumb, Card, PageHeader } from "antd"; import { Tenant } from "@chirpstack/chirpstack-api-grpc-web/api/tenant_pb"; import { Application, CreateApplicationRequest, CreateApplicationResponse, } from "@chirpstack/chirpstack-api-grpc-web/api/application_pb"; import ApplicationForm from "./ApplicationForm"; import ApplicationStore from "../../stores/ApplicationStore"; interface IProps extends RouteComponentProps { tenant: Tenant; } class CreateApplication extends Component { onFinish = (obj: Application) => { obj.setTenantId(this.props.tenant.getId()); let req = new CreateApplicationRequest(); req.setApplication(obj); ApplicationStore.create(req, (resp: CreateApplicationResponse) => { this.props.history.push(`/tenants/${this.props.tenant.getId()}/applications/${resp.getId()}`); }); }; render() { const app = new Application(); return ( ( Tenants {this.props.tenant.getName()} Applications Add )} title="Add application" /> ); } } export default CreateApplication;