fix actions and draft data object

This commit is contained in:
Peter Maquiran
2024-01-17 10:25:16 +01:00
parent 69ee75b039
commit 4314ae1bff
35 changed files with 556 additions and 305 deletions
@@ -400,21 +400,14 @@ export class NewPublicationPage implements OnInit {
if (this.publicationType == '3') {
const loader = this.toastService.loading()
this.publication = {
DateIndex: this.publication.DateIndex,
DocumentId: this.publication.DocumentId,
ProcessId: this.publication.ProcessId,
Title: this.pub.Title,
Message: this.pub.Message,
DatePublication: this.publication.DatePublication,
OriginalFileName: this.publication.OriginalFileName,
Files: this.seletedContent,
}
/* else {
if (this.seletedContent.length >= 1) {
const loader = this.toastService.loading()
this.publication = {
DateIndex: this.publication.DateIndex,
DocumentId: this.publication.DocumentId,
@@ -423,79 +416,77 @@ export class NewPublicationPage implements OnInit {
Message: this.pub.Message,
DatePublication: this.publication.DatePublication,
OriginalFileName: this.publication.OriginalFileName,
FileBase64: this.publication.FileBase64,
FileExtension: this.publication.FileExtension || 'jpeg',
Files: this.seletedContent,
}
} */
try {
const response = await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise()
this.httpErrorHandle.httpsSucessMessagge('Editar publicação')
console.log({ response })
this.close();
} catch (error) {
if (error.status == 404) {
this.PublicationFolderService.deletePost(this.publication.ProcessId, this.publication.DocumentId)
try {
const response = await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise()
this.httpErrorHandle.httpsSucessMessagge('Editar publicação')
console.log({ response })
this.close();
} catch (error) {
if (error.status == 404) {
this.PublicationFolderService.deletePost(this.publication.ProcessId, this.publication.DocumentId)
this.close();
}
this.httpErrorHandle.httpStatusHandle(error)
} finally {
loader.remove()
}
this.httpErrorHandle.httpStatusHandle(error)
} finally {
loader.remove()
} else {
this.toastService._badRequest("É necessário adicionar anexo")
}
}
else {
const date = formatDate(new Date(), 'yyyy-MM-dd HH:mm:ss')
/* if (this.capturedImage != '') { */
this.publication = {
DateIndex: date,
DocumentId: null,
ProcessId: this.folderId,
Title: this.pub.Title,
Message: this.pub.Message,
DatePublication: date,
OriginalFileName: this.capturedImageTitle,
Files: this.seletedContent,
/* FileExtension: 'jpeg', */
}
if (this.seletedContent.length >= 1) {
/* } else if (this.capturedVideo != '') {
this.publication = {
DateIndex: date,
DocumentId: null,
ProcessId: this.folderId,
Title: this.pub.Title,
Message: this.pub.Message,
DatePublication: date,
OriginalFileName: this.capturedImageTitle || 'video',
Files: this.seletedContent,
FileExtension: 'mp4',
}
} */
const date = formatDate(new Date(), 'yyyy-MM-dd HH:mm:ss')
/* if (this.capturedImage != '') { */
this.publication = {
DateIndex: date,
DocumentId: null,
ProcessId: this.folderId,
Title: this.pub.Title,
Message: this.pub.Message,
DatePublication: date,
OriginalFileName: this.capturedImageTitle,
Files: this.seletedContent,
/* FileExtension: 'jpeg', */
}
const loader = this.toastService.loading()
try {
await this.publications.CreatePublication(this.folderId, this.publication).toPromise();
this.close();
this.httpErrorHandle.httpsSucessMessagge('Criar publicação')
window["sharedContent"] = null;
this.close();
} catch (error) {
this.httpErrorHandle.httpStatusHandle(error)
} finally {
loader.remove()
}
const loader = this.toastService.loading()
try {
await this.publications.CreatePublication(this.folderId, this.publication).toPromise();
this.close();
this.httpErrorHandle.httpsSucessMessagge('Criar publicação')
window["sharedContent"] = null;
this.close();
} catch (error) {
this.httpErrorHandle.httpStatusHandle(error)
} finally {
loader.remove()
} else {
this.toastService._badRequest("É necessário adicionar anexo")
}
}
@@ -716,4 +707,3 @@ export class NewPublicationPage implements OnInit {
}
}