fix file upload

This commit is contained in:
Peter Maquiran
2024-01-17 15:11:31 +01:00
parent 26526a8d64
commit be60b13d5d
3 changed files with 45 additions and 24 deletions
@@ -85,7 +85,7 @@ export class NewPublicationPage implements OnInit {
this.filecontent = true;
}
this.SocketConnectionMCRService.connect()
// this.SocketConnectionMCRService.connect()
}
ngOnInit() {
@@ -353,22 +353,22 @@ export class NewPublicationPage implements OnInit {
DatePublication: this.publication.DatePublication,
Files: this.seletedContent,
}
this.publication.Files = this.publication.Files.map( e => ({
FileBase64: e.FileBase64,
FileExtension: e.FileExtension,
OriginalFileName: 'foto'
}))
try {
const response = await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise()
this.httpErroHandle.httpsSucessMessagge('Editar publicação')
this.goBack();
} catch (error) {
this.httpErroHandle.httpStatusHandle(error)
if (error.status == 404) {
@@ -400,14 +400,15 @@ export class NewPublicationPage implements OnInit {
Files: this.seletedContent,
}
this.publication.Files = this.publication.Files.map( e => ({
FileBase64: e.FileBase64,
FileExtension: e.FileExtension,
OriginalFileName: 'foto'
}))
// this.publicationFormMV.setDataToFrom(this.publication)
// this.publicationFormMV.uploadVideosFiles()
// this.publication.Files = this.publication.Files.map( e => ({
// FileBase64: e.FileBase64,
// FileExtension: e.FileExtension,
// OriginalFileName: 'foto'
// }))
//this.publicationFormMV.setDataToFrom(this.publication)
//this.publicationFormMV.uploadVideosFiles()
const loader = this.toastService.loading()
@@ -956,7 +957,7 @@ export class NewPublicationPage implements OnInit {
class UploadFileUseCase {
LakefsRepositoryService: CMAPIService = window["CMAPIService"]
CMAPIService: CMAPIService = window["CMAPIService"]
constructor() {}
async execute(ChucksManager: ChucksManager): Promise<Result<ChucksManager, ChucksManager>> {
@@ -969,7 +970,7 @@ class UploadFileUseCase {
const blob = new Blob([chunk]);
const blobFile = new File([blob], "test.mp4", { type: blob.type });
return await this.LakefsRepositoryService.FileContent({length, path, index, blobFile})
return await this.CMAPIService.FileContent({length, path, index, blobFile})
}
if(!ChucksManager.hasPath()) {
@@ -979,7 +980,7 @@ class UploadFileUseCase {
const blob = new Blob([chuck]);
const blobFile = new File([blob], "test.mp4", { type: blob.type });
const uploadRequest = await this.LakefsRepositoryService.FileContent({length, path, index: initIndex, blobFile})
const uploadRequest = await this.CMAPIService.FileContent({length, path, index: initIndex, blobFile})
if(uploadRequest.isOk()) {