mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
Improve loader
This commit is contained in:
@@ -96,6 +96,8 @@ export class EditActionPage implements OnInit {
|
||||
}
|
||||
console.log(body);
|
||||
|
||||
const loader = this.toastService.loading()
|
||||
|
||||
try {
|
||||
await this.publicationsService.UpdatePresidentialAction(body).toPromise()
|
||||
this.close();
|
||||
@@ -103,6 +105,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()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,13 +110,18 @@ export class NewActionPage implements OnInit {
|
||||
}
|
||||
console.log(this.folder);
|
||||
|
||||
const loader = this.toastService.loading()
|
||||
|
||||
try {
|
||||
await this.publication.CreatePublicationFolder(this.folder).toPromise()
|
||||
this.close();
|
||||
this.toastService.successMessage('Acção presidencial criada')
|
||||
} catch (error) {
|
||||
this.toastService.badRequest('Não foi possivel criar a acção presidencial')
|
||||
} finally {
|
||||
loader.remove()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
close(){
|
||||
|
||||
@@ -1,17 +1,10 @@
|
||||
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
|
||||
import { AlertController, AnimationController, ModalController, NavParams } from '@ionic/angular';
|
||||
|
||||
/* import {Plugins, CameraResultType, CameraSource} from '@capacitor/core'; */
|
||||
import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser';
|
||||
import { AnimationController, ModalController } from '@ionic/angular';
|
||||
import { SafeResourceUrl } from '@angular/platform-browser';
|
||||
import { PublicationsService } from 'src/app/services/publications.service';
|
||||
import { Publication } from 'src/app/models/publication';
|
||||
import { Image } from 'src/app/models/image';
|
||||
import { ThrowStmt } from '@angular/compiler';
|
||||
import { PhotoService } from 'src/app/services/photo.service';
|
||||
//Capacitor
|
||||
/* const { Camera } = Plugins; */
|
||||
|
||||
//Cordova
|
||||
import { Camera, CameraOptions } from '@ionic-native/camera/ngx';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
import { FormControl, FormGroup, Validators } from '@angular/forms';
|
||||
@@ -71,7 +64,7 @@ export class NewPublicationPage implements OnInit {
|
||||
this.takePicture();
|
||||
}
|
||||
|
||||
getPublicationDetail(){
|
||||
getPublicationDetail() {
|
||||
this.showLoader = true;
|
||||
//console.log(this.publicationId);
|
||||
/* console.log(this.folderId); */
|
||||
@@ -177,6 +170,7 @@ export class NewPublicationPage implements OnInit {
|
||||
}
|
||||
console.log('Edit change image');
|
||||
console.log(this.publication);
|
||||
const loader = this.toastService.loading()
|
||||
|
||||
try {
|
||||
console.log(this.publication);
|
||||
@@ -187,6 +181,8 @@ export class NewPublicationPage implements OnInit {
|
||||
this.goBack();
|
||||
} catch (error) {
|
||||
this.toastService.badRequest("Publicação não criado")
|
||||
} finally {
|
||||
loader.remove()
|
||||
}
|
||||
|
||||
}
|
||||
@@ -202,6 +198,7 @@ export class NewPublicationPage implements OnInit {
|
||||
FileBase64: this.publication.FileBase64,
|
||||
FileExtension: 'jpeg',
|
||||
}
|
||||
const loader = this.toastService.loading()
|
||||
|
||||
try {
|
||||
console.log(this.publication);
|
||||
@@ -211,11 +208,13 @@ export class NewPublicationPage implements OnInit {
|
||||
this.goBack();
|
||||
} catch (error) {
|
||||
this.toastService.badRequest("Publicação não criado")
|
||||
} finally {
|
||||
loader.remove()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else{
|
||||
else {
|
||||
|
||||
this.publication = {
|
||||
DateIndex: new Date(),
|
||||
@@ -229,6 +228,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()
|
||||
@@ -237,6 +238,8 @@ export class NewPublicationPage implements OnInit {
|
||||
this.goBackToViewPublications.emit();
|
||||
} catch (error) {
|
||||
this.toastService.badRequest("Publicação não criado")
|
||||
} finally {
|
||||
loader.remove()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user