Added threads number passing.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
RakVhalate 2022-11-24 14:02:25 +10:00
parent 28e0cfb239
commit dae1809c5e
4 changed files with 13 additions and 5 deletions

Binary file not shown.

View File

@ -1,5 +1,6 @@
<div class="op"> <div class="op">
<h4>Тред номер {{op.Thread_Id}}</h4> <h4>Тред номер {{op.Thread_Id}}</h4>
<a [routerLink] ="['/board']" [queryParams]="{thread: op.Thread_Id}" >Тред номер {{op.Thread_Id}} </a>
<p> # {{op.Id}} {{op.Timestamp}}</p> <p> # {{op.Id}} {{op.Timestamp}}</p>
<div> <div>
<a *ngFor="let i of op.ImgURL" [href]="i" target="_blank"> <a *ngFor="let i of op.ImgURL" [href]="i" target="_blank">

View File

@ -2,6 +2,7 @@ import { Component, Input, OnInit } from '@angular/core';
import { ApiChatService } from '../services/api-chat.service'; import { ApiChatService } from '../services/api-chat.service';
import { SinglePost } from '../models/post' import { SinglePost } from '../models/post'
import * as vars from '../var/api' import * as vars from '../var/api'
import {ActivatedRoute} from "@angular/router";
@Component({ @Component({
selector: 'app-SingleThread', selector: 'app-SingleThread',
@ -16,10 +17,11 @@ export class BoardsComponent implements OnInit {
displayed_thread_number = vars.displayed_thread; displayed_thread_number = vars.displayed_thread;
showGuide: boolean = false; showGuide: boolean = false;
constructor(public apiChatService: ApiChatService) { constructor(public apiChatService: ApiChatService, private activatedRoute:ActivatedRoute) {
} }
refreshPosts(boardName: string , threadId:number) { refreshPosts(boardName: string , threadId:number) {
this.apiChatService.getPosts(boardName, threadId).subscribe(response => { this.apiChatService.getPosts(boardName, threadId).subscribe(response => {
this.postsToShow = response this.postsToShow = response
@ -28,7 +30,12 @@ export class BoardsComponent implements OnInit {
} }
ngOnInit(): void { ngOnInit(): void {
this.apiChatService.getPosts('postgres', vars.displayed_thread).subscribe(response => { var threadId = this.activatedRoute.snapshot.queryParamMap.get('thread');
if(threadId != null)
{
this.displayed_thread_number = parseInt(threadId);
}
this.apiChatService.getPosts('postgres', this.displayed_thread_number).subscribe(response => {
this.postsToShow = response this.postsToShow = response
}) })
} }

View File

@ -1,6 +1,6 @@
export const api_endpoint: string = 'http://api.vdk2ch.ru:5000/'; //export const api_endpoint: string = 'http://api.vdk2ch.ru:5000/';
//export const api_endpoint: string = 'http://localhost:7141/'; export const api_endpoint: string = 'http://localhost:7141/';
export var displayed_thread: number = 2; export var displayed_thread: number;
export function setDisplayedThread(toset:number){ export function setDisplayedThread(toset:number){
displayed_thread = toset; displayed_thread = toset;
}; };