mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
All changes i made
This commit is contained in:
@@ -8,6 +8,7 @@ import { ToastService } from 'src/app/services/toast.service';
|
||||
import { FormControl, FormGroup, Validators } from '@angular/forms';
|
||||
import { ThemeService } from 'src/app/services/theme.service';
|
||||
import { Camera, CameraResultType, CameraSource} from '@capacitor/camera';
|
||||
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
|
||||
@Component({
|
||||
selector: 'app-new-publication',
|
||||
templateUrl: './new-publication.page.html',
|
||||
@@ -48,7 +49,8 @@ export class NewPublicationPage implements OnInit {
|
||||
public photoService: PhotoService,
|
||||
private publications: PublicationsService,
|
||||
private toastService: ToastService,
|
||||
public ThemeService: ThemeService
|
||||
public ThemeService: ThemeService,
|
||||
private httpErroHandle: HttpErrorHandle
|
||||
) {
|
||||
this.publicationTitle = 'Nova Publicação';
|
||||
}
|
||||
@@ -115,11 +117,11 @@ export class NewPublicationPage implements OnInit {
|
||||
|
||||
this.Form = new FormGroup({
|
||||
Subject: new FormControl(this.pub.Title, [
|
||||
// Validators.required,
|
||||
Validators.required,
|
||||
// Validators.minLength(4)
|
||||
]),
|
||||
Message: new FormControl(this.pub.Message, [
|
||||
// Validators.required
|
||||
Validators.required,
|
||||
Validators.maxLength(1000)
|
||||
])
|
||||
})
|
||||
@@ -131,7 +133,11 @@ export class NewPublicationPage implements OnInit {
|
||||
this.injectValidation()
|
||||
this.runValidation()
|
||||
|
||||
if(this.Form.invalid) return false
|
||||
if(this.Form.invalid) {
|
||||
return false
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
if(this.publicationType == '3') {
|
||||
|
||||
@@ -155,15 +161,11 @@ export class NewPublicationPage implements OnInit {
|
||||
|
||||
try {
|
||||
await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise()
|
||||
this.toastService._successMessage()
|
||||
this.httpErroHandle.httpsSucessMessagge('Criar publicação')
|
||||
|
||||
this.goBack();
|
||||
} catch (error) {
|
||||
if(error.status == 0) {
|
||||
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
|
||||
} else {
|
||||
this.toastService._badRequest()
|
||||
}
|
||||
this.httpErroHandle.httpStatusHandle(error)
|
||||
} finally {
|
||||
loader.remove()
|
||||
}
|
||||
@@ -188,15 +190,11 @@ export class NewPublicationPage implements OnInit {
|
||||
|
||||
await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise()
|
||||
|
||||
this.toastService._successMessage()
|
||||
this.httpErroHandle.httpsSucessMessagge('Criar publicação')
|
||||
|
||||
this.goBack();
|
||||
} catch (error) {
|
||||
if(error.status == 0) {
|
||||
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
|
||||
} else {
|
||||
this.toastService._badRequest()
|
||||
}
|
||||
this.httpErroHandle.httpStatusHandle(error)
|
||||
} finally {
|
||||
loader.remove()
|
||||
}
|
||||
@@ -220,15 +218,11 @@ export class NewPublicationPage implements OnInit {
|
||||
|
||||
try {
|
||||
await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise()
|
||||
this.toastService._successMessage()
|
||||
this.httpErroHandle.httpsSucessMessagge('Criar publicação')
|
||||
|
||||
this.goBack();
|
||||
} catch (error) {
|
||||
if(error.status == 0) {
|
||||
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
|
||||
} else {
|
||||
this.toastService._badRequest()
|
||||
}
|
||||
this.httpErroHandle.httpStatusHandle(error)
|
||||
} finally {
|
||||
loader.remove()
|
||||
}
|
||||
@@ -255,15 +249,11 @@ export class NewPublicationPage implements OnInit {
|
||||
try {
|
||||
|
||||
await this.publications.CreatePublication(this.folderId, this.publication).toPromise()
|
||||
this.toastService._successMessage()
|
||||
this.httpErroHandle.httpsSucessMessagge('Criar publicação')
|
||||
|
||||
this.goBackToViewPublications.emit();
|
||||
} catch (error) {
|
||||
if(error.status == 0) {
|
||||
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
|
||||
} else {
|
||||
this.toastService._badRequest()
|
||||
}
|
||||
this.httpErroHandle.httpStatusHandle(error)
|
||||
} finally {
|
||||
loader.remove()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user