Improve loader

This commit is contained in:
Peter Maquiran
2021-07-12 11:13:29 +01:00
parent c526426aec
commit 507ebd691a
34 changed files with 400 additions and 32 deletions
@@ -98,7 +98,8 @@ export class EditActionPage implements OnInit {
ActionType: this.folder.ActionType,
}
console.log(body);
const loader = this.toastService.loading()
try {
await this.publicationsService.UpdatePresidentialAction(body).toPromise()
this.close();
@@ -106,6 +107,9 @@ export class EditActionPage implements OnInit {
this.toastService.successMessage('Acção presidencial atualizada')
} catch (error) {
this.toastService.badRequest('Não foi possivel atualizar a acção presidencial')
} finally {
loader.remove()
}
}
}
@@ -136,20 +136,21 @@ export class NewActionPage implements OnInit {
}
let loader = this.toastService.loading()
const loader = this.toastService.loading()
try {
await this.publication.CreatePublicationFolder(this.folder).toPromise();
loader.remove()
this.toastService.successMessage("Ação presidencial criado");
this.close();
} catch (error) {
loader.remove()
this.toastService.badRequest("Ação presidencial não criado");
} finally {
loader.remove()
}
}
close(){
@@ -164,6 +164,8 @@ export class NewPublicationPage implements OnInit {
FileExtension: 'jpeg',
}
const loader = this.toastService.loading()
try {
console.log(this.publication);
@@ -173,6 +175,8 @@ export class NewPublicationPage implements OnInit {
this.close();
} catch (error) {
this.toastService.badRequest("Publicação não criado")
} finally {
loader.remove()
}
}
@@ -190,6 +194,9 @@ export class NewPublicationPage implements OnInit {
}
/* console.log('Edit - keep image');
console.log(this.publication); */
const loader = this.toastService.loading()
try {
console.log(this.publication);
await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise()
@@ -198,6 +205,8 @@ export class NewPublicationPage implements OnInit {
this.close();
} catch (error) {
this.toastService.badRequest("Publicação não criado")
} finally {
loader.remove()
}
}
@@ -215,6 +224,8 @@ export class NewPublicationPage implements OnInit {
FileExtension: 'jpeg',
}
const loader = this.toastService.loading()
try {
console.log(this.publication);
await this.publications.CreatePublication(this.folderId, this.publication).toPromise();
@@ -225,6 +236,8 @@ export class NewPublicationPage implements OnInit {
this.close();
} catch (error) {
this.toastService.badRequest("Publicação não criado")
} finally {
loader.remove()
}
}
@@ -83,12 +83,16 @@ export class PublicationDetailPage implements OnInit {
async deletePost(){
const loader = this.toastService.loading()
try {
await this.publications.DeletePublication(this.folderId, this.publicationId).toPromise();
this.toastService.successMessage('Publicação eliminado')
this.close();
} catch (error) {
this.toastService.badRequest('Publicação não eliminado')
} finally {
loader.remove()
}
}
@@ -94,6 +94,8 @@ export class PublicationDetailPage implements OnInit {
async deletePost(){
const loader = this.toastService.loading()
try {
await this.publications.DeletePublication(this.folderId, this.publicationId).toPromise();
this.toastService.successMessage('Publicaçao eliminado')
@@ -103,6 +105,8 @@ export class PublicationDetailPage implements OnInit {
} catch (error) {
this.toastService.badRequest('Publicaçao não eliminado')
} finally {
loader.remove()
}
}