Support of board name parameter.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
RakVhalate 2022-11-12 03:10:08 +10:00
parent 85fdc0164f
commit 93c5826bff
3 changed files with 10 additions and 9 deletions

View File

@ -1,11 +1,12 @@
<div class="wrappe"> <div class="wrappe">
<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">
<app-send-post></app-send-post>, <app-send-post></app-send-post>,
<button (click)="refreshPosts()">Обновить</button> <h2>/postgres/</h2>
<button (click)="refreshPosts('postgres')">Общий раздел</button>
<post-single <post-single
*ngFor="let post of postsToShow" [post]="post" *ngFor="let post of postsToShow" [post]="post"
></post-single> ></post-single>
<button (click)="refreshPosts()">Обновить</button> <button (click)="refreshPosts('postgres')">Обновить</button>
<br> <br>
<div class="hexagon"> <div class="hexagon">
<div class="hexagon-inside"> <div class="hexagon-inside">

View File

@ -17,14 +17,14 @@ export class BoardsComponent implements OnInit {
} }
refreshPosts() { refreshPosts(boardName: string) {
this.apiChatService.getPosts().subscribe(response => { this.apiChatService.getPosts(boardName).subscribe(response => {
this.postsToShow = response this.postsToShow = response
}) })
} }
ngOnInit(): void { ngOnInit(): void {
this.apiChatService.getPosts().subscribe(response => { this.apiChatService.getPosts('postgres').subscribe(response => {
this.postsToShow = response this.postsToShow = response
}) })
} }

View File

@ -10,10 +10,10 @@ export class ApiChatService {
constructor(private http: HttpClient) { constructor(private http: HttpClient) {
} }
getPosts(): Observable<SinglePost[]> { getPosts(boardName:string): Observable<SinglePost[]> {
//console.log("Получаю посты и картинки"); //console.log("Получаю посты и картинки");
return this.http.get<SinglePost[]>('http://api.vdk2ch.ru:5000/List/'); //return this.http.get<SinglePost[]>('http://api.vdk2ch.ru:5000/List/?board=' + boardName);
//return this.http.get<SinglePost[]>('http://localhost:7141/List/'); return this.http.get<SinglePost[]>('http://localhost:7141/List/?board=' + boardName);
} }
sendPostToApi(text: string, imgUrl: string) { sendPostToApi(text: string, imgUrl: string) {