added posting function
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
75b4fe3716
commit
0ae993fb9d
@ -3,7 +3,8 @@
|
|||||||
"",
|
"",
|
||||||
"\\src",
|
"\\src",
|
||||||
"\\src\\app",
|
"\\src\\app",
|
||||||
"\\src\\app\\boards"
|
"\\src\\app\\boards",
|
||||||
|
"\\src\\app\\boards\\send-post"
|
||||||
],
|
],
|
||||||
"SelectedNode": "\\src\\app\\boards\\boards.component.html",
|
"SelectedNode": "\\src\\app\\boards\\boards.component.html",
|
||||||
"PreviewInSolutionExplorer": false
|
"PreviewInSolutionExplorer": false
|
||||||
|
BIN
.vs/slnx.sqlite
BIN
.vs/slnx.sqlite
Binary file not shown.
@ -10,6 +10,7 @@ import { BoardsComponent } from './boards/boards.component';
|
|||||||
import { NotFoundComponent } from './not-found/not-found.component';
|
import { NotFoundComponent } from './not-found/not-found.component';
|
||||||
import { ApiChatService } from './api-chat.service';
|
import { ApiChatService } from './api-chat.service';
|
||||||
import { FormsModule } from '@angular/forms';
|
import { FormsModule } from '@angular/forms';
|
||||||
|
import { SendPostComponent } from './boards/send-post/send-post.component';
|
||||||
|
|
||||||
const appRoutes: Routes = [
|
const appRoutes: Routes = [
|
||||||
{ path: '', component: HomeComponent },
|
{ path: '', component: HomeComponent },
|
||||||
@ -24,7 +25,8 @@ const appRoutes: Routes = [
|
|||||||
HomeComponent,
|
HomeComponent,
|
||||||
AboutComponent,
|
AboutComponent,
|
||||||
BoardsComponent,
|
BoardsComponent,
|
||||||
NotFoundComponent
|
NotFoundComponent,
|
||||||
|
SendPostComponent
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
BrowserModule,
|
BrowserModule,
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
<img src="http://static.vdk2ch.ru:15555/test-public/16657431265390.png" alt="свiня" width="150">
|
<img src="http://static.vdk2ch.ru:15555/test-public/16657431265390.png" alt="свiня" width="150">
|
||||||
<p>Борды работают, это в хтмл!</p>
|
<app-send-post></app-send-post>,
|
||||||
|
|
||||||
<button (click)="listPosts()">Обновить</button>
|
<button (click)="listPosts()">Обновить</button>
|
||||||
<div *ngIf="response">
|
<div *ngIf="response">
|
||||||
<div class="singlePost" *ngFor="let post of response">
|
<div class="singlePost" *ngFor="let post of response">
|
||||||
@ -17,4 +18,4 @@
|
|||||||
<div class="hexagon-image">
|
<div class="hexagon-image">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
0
src/app/boards/send-post/send-post.component.css
Normal file
0
src/app/boards/send-post/send-post.component.css
Normal file
5
src/app/boards/send-post/send-post.component.html
Normal file
5
src/app/boards/send-post/send-post.component.html
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<p>
|
||||||
|
<button (click)="sendPost(textToPost.value)">Отправить</button>
|
||||||
|
</p>
|
||||||
|
<input type="text" size="80" value="Печатать сюда" #textToPost>
|
||||||
|
<p></p>
|
23
src/app/boards/send-post/send-post.component.spec.ts
Normal file
23
src/app/boards/send-post/send-post.component.spec.ts
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { SendPostComponent } from './send-post.component';
|
||||||
|
|
||||||
|
describe('SendPostComponent', () => {
|
||||||
|
let component: SendPostComponent;
|
||||||
|
let fixture: ComponentFixture<SendPostComponent>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
declarations: [ SendPostComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
|
||||||
|
fixture = TestBed.createComponent(SendPostComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
34
src/app/boards/send-post/send-post.component.ts
Normal file
34
src/app/boards/send-post/send-post.component.ts
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
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 {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Reference in New Issue
Block a user