diff --git a/src/app/models/picResponse.ts b/src/app/models/picResponse.ts new file mode 100644 index 0000000..cf90229 --- /dev/null +++ b/src/app/models/picResponse.ts @@ -0,0 +1,6 @@ +export interface IPicresponse { + contentType: null + serializerSettings: null + statusCode: null + value: string +} diff --git a/src/app/send-post/send-post.component.html b/src/app/send-post/send-post.component.html index d62918f..6908954 100644 --- a/src/app/send-post/send-post.component.html +++ b/src/app/send-post/send-post.component.html @@ -7,5 +7,5 @@
{{filename}} : {{progress}}
+Картинка в статике: {{filename}}
diff --git a/src/app/send-post/send-post.component.ts b/src/app/send-post/send-post.component.ts index 682466f..eaf252d 100644 --- a/src/app/send-post/send-post.component.ts +++ b/src/app/send-post/send-post.component.ts @@ -1,6 +1,7 @@ import { Component, EventEmitter, OnInit, Output } from '@angular/core'; import { ApiChatService } from '../services/api-chat.service'; import { MinIoService } from '../services/min-io.service.' +import {IPicresponse} from "../models/picResponse"; @Component({ selector: 'app-send-post', @@ -11,20 +12,25 @@ export class SendPostComponent implements OnInit { progress: number; message: string; - filename = ''; + filename = '0'; + + picResponse: IPicresponse + constructor(public apiChatService: ApiChatService, public minIoService: MinIoService) { } sendPost(text: string) { - this.apiChatService.sendPostToApi(text).subscribe(); + this.apiChatService.sendPostToApi(text, this.filename).subscribe(); } - sendPic(event: any) { - this.filename = event.target.files[0].name; - //console.log(event.target.files[0]); - this.apiChatService.sendpic(event.target.files[0]).subscribe(); + sendPic(event: any) { + this.apiChatService.sendpic(event.target.files[0]).subscribe( + response => { + this.picResponse = response + }); + this.filename = this.picResponse.value.toString() } ngOnInit(): void { diff --git a/src/app/services/api-chat.service.ts b/src/app/services/api-chat.service.ts index b75064c..7fb58f4 100644 --- a/src/app/services/api-chat.service.ts +++ b/src/app/services/api-chat.service.ts @@ -12,28 +12,29 @@ export class ApiChatService { getPosts(): Observable