Publication

This commit is contained in:
Peter Maquiran
2023-08-23 09:55:14 +01:00
parent a06bc4a409
commit b81e876dde
6 changed files with 71 additions and 101 deletions
@@ -167,6 +167,7 @@ export class NewPublicationPage implements OnInit {
}
if(this.publicationType == '3') {
const loader = this.toastService.loading()
if(this.capturedImage != '') {
@@ -181,23 +182,6 @@ export class NewPublicationPage implements OnInit {
FileBase64: this.capturedImage,
FileExtension: 'jpeg',
}
const loader = this.toastService.loading()
try {
const response = await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise()
this.httpErroHandle.httpsSucessMessagge('Criar publicação')
console.log({response})
this.goBack();
} catch (error) {
this.httpErroHandle.httpStatusHandle(error)
} finally {
loader.remove()
}
}
else if (!this.PublicationFolderService.PublicationHasImage(this.publication)) { //
@@ -212,21 +196,6 @@ export class NewPublicationPage implements OnInit {
FileBase64: "",
FileExtension: this.publication.FileExtension,
}
const loader = this.toastService.loading()
try {
const response = await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise()
this.httpErroHandle.httpsSucessMessagge('Criar publicação')
console.log({response})
this.goBack();
} catch (error) {
this.httpErroHandle.httpStatusHandle(error)
} finally {
loader.remove()
}
} else {
this.publication = {
@@ -241,28 +210,29 @@ export class NewPublicationPage implements OnInit {
FileExtension: 'jpeg',
}
const loader = this.toastService.loading()
try {
const response =await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise()
this.httpErroHandle.httpsSucessMessagge('Criar publicação')
console.log({response})
this.goBack();
} catch (error) {
this.httpErroHandle.httpStatusHandle(error)
} finally {
loader.remove()
}
}
try {
const response = await this.publications.CreatePublication(this.publication.ProcessId, this.publication).toPromise()
try {
await this.publications.DeletePublication(this.folderId, this.publication.DocumentId).toPromise();
} catch(error) {}
this.httpErroHandle.httpsSucessMessagge('Editar publicação')
console.log({response})
this.goBack();
} catch (error) {
this.httpErroHandle.httpStatusHandle(error)
} finally {
loader.remove()
}
this.PublicationFolderService.deletePost(this.publication.ProcessId, this.publication.DocumentId)
this.PublicationFolderService.deletePost(this.publication.DocumentId, this.publication.ProcessId)
}
else {