|
- import { Component } from '@angular/core';
- import { HttpClient } from '@angular/common/http';
- import { FormControl } from '@angular/forms';
-
- @Component({
- selector: 'app-root',
- templateUrl: './app.component.html',
- styleUrls: ['./app.component.scss']
- })
- export class AppComponent {
- title = 'TBConsoleClient';
-
- logMessages = '';
-
- commandControl: FormControl = new FormControl('');
-
- constructor(private http: HttpClient) {
- }
-
- async sendCommand() {
- try {
- const res = await this.http.post('http://localhost:8019/', this.commandControl.value, {responseType: 'text'}).toPromise();
- this.logMessages += res + "\n";
- } catch (e) {
- if (e.status == 0)
- this.logMessages += "Failed to contact mod! Make sure it is running and listening.\n";
- else
- this.logMessages += e.message + "\n";
- }
- }
- }
|