mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
Improve success message
This commit is contained in:
@@ -2,6 +2,8 @@ import { Component, OnInit } from '@angular/core';
|
||||
import { ModalController, NavParams } from '@ionic/angular';
|
||||
import { Publication } from 'src/app/models/publication';
|
||||
import { PublicationsService } from 'src/app/services/publications.service';
|
||||
import { BadRequestComponent } from 'src/app/shared/popover/bad-request/bad-request.component';
|
||||
import { SuccessMessageComponent } from 'src/app/shared/popover/success-message/success-message.component';
|
||||
import { ImageModalPage } from '../gallery/image-modal/image-modal.page';
|
||||
import { NewPublicationPage } from '../new-publication/new-publication.page';
|
||||
|
||||
@@ -76,12 +78,16 @@ export class PublicationDetailPage implements OnInit {
|
||||
this.modalController.dismiss();
|
||||
}
|
||||
|
||||
deletePost(){
|
||||
this.publications.DeletePublication(this.folderId, this.publicationId).then(res =>{
|
||||
console.log(res);
|
||||
|
||||
});
|
||||
this.close();
|
||||
async deletePost(){
|
||||
|
||||
try {
|
||||
await this.publications.DeletePublication(this.folderId, this.publicationId).toPromise();
|
||||
this.successMessage()
|
||||
this.close();
|
||||
} catch (error) {
|
||||
this.badRequest()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async editPost(publicationType:any) {
|
||||
@@ -114,4 +120,38 @@ export class PublicationDetailPage implements OnInit {
|
||||
}).then(modal => modal.present());
|
||||
}
|
||||
|
||||
|
||||
async successMessage(message?: string) {
|
||||
|
||||
const modal = await this.modalController.create({
|
||||
component: SuccessMessageComponent,
|
||||
componentProps: {
|
||||
message: message || 'Processo efetuado' ,
|
||||
},
|
||||
cssClass: 'modal modal-desktop'
|
||||
});
|
||||
|
||||
modal.present()
|
||||
|
||||
setTimeout(()=>{
|
||||
modal.dismiss()
|
||||
},3000)
|
||||
|
||||
}
|
||||
|
||||
async badRequest() {
|
||||
const modal = await this.modalController.create({
|
||||
component: BadRequestComponent,
|
||||
componentProps: {
|
||||
message: 'Processo não realizado com sucesso',
|
||||
},
|
||||
cssClass: 'modal modal-desktop'
|
||||
});
|
||||
|
||||
modal.present()
|
||||
|
||||
setTimeout(()=>{
|
||||
modal.dismiss()
|
||||
},3000)
|
||||
}
|
||||
}
|
||||
|
||||
+48
-5
@@ -2,6 +2,7 @@ import { Component, OnInit } from '@angular/core';
|
||||
import { ModalController, NavParams } from '@ionic/angular';
|
||||
import { Publication } from 'src/app/models/publication';
|
||||
import { PublicationsService } from 'src/app/services/publications.service';
|
||||
import { BadRequestComponent } from 'src/app/shared/popover/bad-request/bad-request.component';
|
||||
import { ImageModalPage } from '../../gallery/image-modal/image-modal.page';
|
||||
import { NewPublicationPage } from '../../new-publication/new-publication.page';
|
||||
|
||||
@@ -75,13 +76,20 @@ export class PublicationDetailPage implements OnInit {
|
||||
this.modalController.dismiss();
|
||||
}
|
||||
|
||||
deletePost(){
|
||||
this.publications.DeletePublication(this.folderId, this.publicationId).then(res =>{
|
||||
console.log(res);
|
||||
});
|
||||
this.close();
|
||||
|
||||
async deletePost(){
|
||||
|
||||
try {
|
||||
await this.publications.DeletePublication(this.folderId, this.publicationId).toPromise();
|
||||
this.successMessage()
|
||||
this.goBackToViewPublications.emit();
|
||||
} catch (error) {
|
||||
this.badRequest()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
async editPost(publicationType:any) {
|
||||
console.log(this.publication);
|
||||
const modal = await this.modalController.create({
|
||||
@@ -110,4 +118,39 @@ export class PublicationDetailPage implements OnInit {
|
||||
}).then(modal => modal.present());
|
||||
}
|
||||
|
||||
|
||||
async successMessage(message?: string) {
|
||||
|
||||
const modal = await this.modalController.create({
|
||||
component: SuccessMessageComponent,
|
||||
componentProps: {
|
||||
message: message || 'Processo efetuado' ,
|
||||
},
|
||||
cssClass: 'modal modal-desktop'
|
||||
});
|
||||
|
||||
modal.present()
|
||||
|
||||
setTimeout(()=>{
|
||||
modal.dismiss()
|
||||
},3000)
|
||||
|
||||
}
|
||||
|
||||
async badRequest() {
|
||||
const modal = await this.modalController.create({
|
||||
component: BadRequestComponent,
|
||||
componentProps: {
|
||||
message: 'Processo não realizado com sucesso',
|
||||
},
|
||||
cssClass: 'modal modal-desktop'
|
||||
});
|
||||
|
||||
modal.present()
|
||||
|
||||
setTimeout(()=>{
|
||||
modal.dismiss()
|
||||
},3000)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user