35 lines
673 B
TypeScript
35 lines
673 B
TypeScript
import { Component, OnInit } from '@angular/core';
|
|
import { HttpClient } from '@angular/common/http';
|
|
|
|
@Component({
|
|
selector: 'app-send-post',
|
|
templateUrl: './send-post.component.html',
|
|
styleUrls: ['./send-post.component.css']
|
|
})
|
|
export class SendPostComponent implements OnInit {
|
|
|
|
constructor(private http: HttpClient) {
|
|
console.log("Открыто окно постинга");
|
|
}
|
|
|
|
sendPost(text: string) {
|
|
console.log("Отправляю пост...");
|
|
var postToSend =
|
|
{
|
|
Date: Date,
|
|
Id: 0,
|
|
Text: text
|
|
}
|
|
|
|
|
|
this.http.post('http://api.vdk2ch.ru:5000/PostTo', postToSend).subscribe();
|
|
|
|
|
|
}
|
|
|
|
|
|
ngOnInit(): void {
|
|
}
|
|
|
|
}
|