Compare commits
No commits in common. "97baca05a7e3b341997ed350a24835000c61b510" and "3a4d3fea18d4c3cad3b6a864e8b272eb82cd561f" have entirely different histories.
97baca05a7
...
3a4d3fea18
@ -1,6 +1,10 @@
|
|||||||
{
|
{
|
||||||
"ExpandedNodes": [
|
"ExpandedNodes": [
|
||||||
""
|
"",
|
||||||
|
"\\src",
|
||||||
|
"\\src\\app",
|
||||||
|
"\\src\\app\\about",
|
||||||
|
"\\src\\app\\boards"
|
||||||
],
|
],
|
||||||
"PreviewInSolutionExplorer": false
|
"PreviewInSolutionExplorer": false
|
||||||
}
|
}
|
BIN
.vs/slnx.sqlite
BIN
.vs/slnx.sqlite
Binary file not shown.
@ -1,6 +1,6 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
// двач лучший двач
|
// двач лучший двач
|
||||||
import { ApiChatService } from '../services/api-chat.service';
|
import { ApiChatService } from '../api-chat.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-about',
|
selector: 'app-about',
|
||||||
|
8
src/app/api-chat.service.ts
Normal file
8
src/app/api-chat.service.ts
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
|
||||||
|
@Injectable({
|
||||||
|
providedIn: 'root'
|
||||||
|
})
|
||||||
|
export class ApiChatService {
|
||||||
|
|
||||||
|
}
|
@ -8,10 +8,9 @@ import { HomeComponent } from './home/home.component';
|
|||||||
import { AboutComponent } from './about/about.component';
|
import { AboutComponent } from './about/about.component';
|
||||||
import { BoardsComponent } from './boards/boards.component';
|
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 './services/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';
|
import { SendPostComponent } from './boards/send-post/send-post.component';
|
||||||
import { PostComponent } from './boards/post/post.component'
|
|
||||||
|
|
||||||
const appRoutes: Routes = [
|
const appRoutes: Routes = [
|
||||||
{ path: '', component: HomeComponent },
|
{ path: '', component: HomeComponent },
|
||||||
@ -27,7 +26,6 @@ const appRoutes: Routes = [
|
|||||||
AboutComponent,
|
AboutComponent,
|
||||||
BoardsComponent,
|
BoardsComponent,
|
||||||
NotFoundComponent,
|
NotFoundComponent,
|
||||||
PostComponent,
|
|
||||||
SendPostComponent
|
SendPostComponent
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
|
@ -1,16 +1,23 @@
|
|||||||
<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>
|
|
||||||
<post-single
|
<button (click)="listPosts()">Обновить</button>
|
||||||
*ngFor="let post of postsToShow" [post]="post"
|
<div *ngIf="response">
|
||||||
></post-single>
|
<div class="singlePost" *ngFor="let post of response">
|
||||||
<button (click)="refreshPosts()">Обновить</button>
|
<a href="#{{post.Id}}"></a>
|
||||||
|
<img src="http://static.vdk2ch.ru:15555/test-public/оладий.jpg" alt="anonpls" width="140">
|
||||||
|
<p> >>{{post.Id}} {{post.Date}}</p>
|
||||||
|
<p>{{post.Text}}</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
<br>
|
<br>
|
||||||
<div class="hexagon">
|
<div class="hexagon">
|
||||||
<div class="hexagon-inside">
|
<div class="hexagon-inside">
|
||||||
<div class="hexagon-image">
|
<div class="hexagon-image">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
@ -1,7 +1,6 @@
|
|||||||
import { Component, Input, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { ApiChatService } from '../services/api-chat.service';
|
import { ApiChatService } from '../api-chat.service';
|
||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
import { SinglePost } from '../models/post'
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-boards',
|
selector: 'app-boards',
|
||||||
@ -11,24 +10,24 @@ import { SinglePost } from '../models/post'
|
|||||||
export class BoardsComponent implements OnInit {
|
export class BoardsComponent implements OnInit {
|
||||||
command: string = "";
|
command: string = "";
|
||||||
response: any;
|
response: any;
|
||||||
postsToShow: SinglePost[] = [] //products: Iproduct[] = data
|
|
||||||
|
|
||||||
constructor(public apiChatService: ApiChatService) {
|
constructor(private http: HttpClient) {
|
||||||
|
console.log("Boards opened");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
refreshPosts() {
|
listPosts() {
|
||||||
this.apiChatService.getPosts().subscribe(response => {
|
console.log("Получаю данные...");
|
||||||
this.postsToShow = response
|
this.http.get('http://api.vdk2ch.ru:5000/List')
|
||||||
})
|
.subscribe((response)=> {
|
||||||
|
this.response = response;
|
||||||
|
console.log(this.response);
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.apiChatService.getPosts().subscribe(response => {
|
this.listPosts();
|
||||||
this.postsToShow = response
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
.post {
|
|
||||||
border-width: 1;
|
|
||||||
border-color: rgb(190,190,190);
|
|
||||||
border-style: solid;
|
|
||||||
background-color: #F0D0B6;
|
|
||||||
border-radius: 5px;
|
|
||||||
width: 500px;
|
|
||||||
word-break: break-word;
|
|
||||||
word-wrap: break-word;
|
|
||||||
}
|
|
@ -1,5 +0,0 @@
|
|||||||
<div class="post">
|
|
||||||
<img src="http://static.vdk2ch.ru:15555/test-public/оладий.jpg" alt="anonpls" width="140"> # {{post.Id}}
|
|
||||||
<h3>{{post.Date}}</h3>
|
|
||||||
<h2>{{post.Text}}</h2>
|
|
||||||
</div>
|
|
@ -1,19 +0,0 @@
|
|||||||
import { Component, OnInit, Input } from '@angular/core';
|
|
||||||
import { SinglePost } from '../../models/post';
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'post-single',
|
|
||||||
templateUrl: './post.component.html',
|
|
||||||
styleUrls: [`./post.component.css`]
|
|
||||||
})
|
|
||||||
export class PostComponent implements OnInit {
|
|
||||||
|
|
||||||
|
|
||||||
@Input() post: SinglePost
|
|
||||||
|
|
||||||
ngOnInit(): void {
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +1,5 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
import { ApiChatService } from '../../services/api-chat.service';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-send-post',
|
selector: 'app-send-post',
|
||||||
@ -9,11 +8,23 @@ import { ApiChatService } from '../../services/api-chat.service';
|
|||||||
})
|
})
|
||||||
export class SendPostComponent implements OnInit {
|
export class SendPostComponent implements OnInit {
|
||||||
|
|
||||||
constructor(public apiChatService: ApiChatService) {
|
constructor(private http: HttpClient) {
|
||||||
|
console.log("Открыто окно постинга");
|
||||||
}
|
}
|
||||||
|
|
||||||
sendPost(text: string) {
|
sendPost(text: string) {
|
||||||
this.apiChatService.sendPostToApi(text).subscribe();
|
console.log("Отправляю пост...");
|
||||||
|
var postToSend =
|
||||||
|
{
|
||||||
|
Date: Date,
|
||||||
|
Id: 0,
|
||||||
|
Text: text
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
this.http.post('http://api.vdk2ch.ru:5000/PostTo', postToSend).subscribe();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
import { ApiChatService } from '../api-chat.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-home',
|
selector: 'app-home',
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
export interface SinglePost {
|
|
||||||
Date: string
|
|
||||||
Id: number
|
|
||||||
Text: string
|
|
||||||
|
|
||||||
}
|
|
@ -1 +1 @@
|
|||||||
<p>Страничка не найдена. Попробуйте внимательнее.</p>
|
<p>not-found works!</p>
|
||||||
|
@ -2,8 +2,7 @@ import { Component, OnInit } from '@angular/core';
|
|||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-not-found',
|
selector: 'app-not-found',
|
||||||
templateUrl: './not-found.component.html',
|
template: `<h3>Страница не найдена.<h3>`
|
||||||
styleUrls: ['./not-found.component.css']
|
|
||||||
})
|
})
|
||||||
export class NotFoundComponent implements OnInit {
|
export class NotFoundComponent implements OnInit {
|
||||||
|
|
||||||
|
@ -1,28 +0,0 @@
|
|||||||
import { Injectable } from '@angular/core';
|
|
||||||
import { HttpClient } from '@angular/common/http';
|
|
||||||
import { Observable } from 'rxjs';
|
|
||||||
import { SinglePost } from '../models/post';
|
|
||||||
|
|
||||||
@Injectable({
|
|
||||||
providedIn: 'root'
|
|
||||||
})
|
|
||||||
export class ApiChatService {
|
|
||||||
constructor(private http: HttpClient) {
|
|
||||||
}
|
|
||||||
|
|
||||||
getPosts(): Observable<SinglePost[]> {
|
|
||||||
console.log("Получаю данные из сервиса");
|
|
||||||
return this.http.get<SinglePost[]>('http://api.vdk2ch.ru:5000/List/');
|
|
||||||
}
|
|
||||||
|
|
||||||
sendPostToApi(text: string) {
|
|
||||||
console.log("Отправляю пост...");
|
|
||||||
var postToSend =
|
|
||||||
{
|
|
||||||
Date: Date,
|
|
||||||
Id: 0,
|
|
||||||
Text: text
|
|
||||||
}
|
|
||||||
return this.http.post('http://api.vdk2ch.ru:5000/PostTo', postToSend)
|
|
||||||
}
|
|
||||||
}
|
|
@ -7,7 +7,7 @@
|
|||||||
"forceConsistentCasingInFileNames": true,
|
"forceConsistentCasingInFileNames": true,
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"noImplicitOverride": true,
|
"noImplicitOverride": true,
|
||||||
"noPropertyAccessFromIndexSignature": false,
|
"noPropertyAccessFromIndexSignature": true,
|
||||||
"noImplicitReturns": true,
|
"noImplicitReturns": true,
|
||||||
"noFallthroughCasesInSwitch": true,
|
"noFallthroughCasesInSwitch": true,
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
@ -21,8 +21,7 @@
|
|||||||
"lib": [
|
"lib": [
|
||||||
"es2020",
|
"es2020",
|
||||||
"dom"
|
"dom"
|
||||||
],
|
]
|
||||||
"strictPropertyInitialization" : false
|
|
||||||
},
|
},
|
||||||
"angularCompilerOptions": {
|
"angularCompilerOptions": {
|
||||||
"enableI18nLegacyMessageIdFormat": false,
|
"enableI18nLegacyMessageIdFormat": false,
|
||||||
|
Reference in New Issue
Block a user