This commit is contained in:
tiago.kayaya
2021-10-15 15:21:26 +01:00
parent 887c9c2186
commit fcd518e8a3
5 changed files with 70 additions and 101 deletions
+3 -2
View File
@@ -57,7 +57,7 @@ import { fab } from '@fortawesome/free-brands-svg-icons'
import { ScreenOrientation } from '@ionic-native/screen-orientation/ngx';
import { PdfViewerModule } from 'ng2-pdf-viewer';
import { SQLite } from '@ionic-native/sqlite/ngx';
import { CookieService } from 'ngx-cookie-service';
@NgModule({
declarations: [AppComponent],
@@ -111,7 +111,8 @@ import { SQLite } from '@ionic-native/sqlite/ngx';
ScreenOrientation,
Network,
File,
SQLite
SQLite,
CookieService
],
bootstrap: [AppComponent],
schemas: [CUSTOM_ELEMENTS_SCHEMA]
@@ -184,7 +184,7 @@ export class ExpedientTaskModalPage implements OnInit {
}
runValidation() {
this.validateFrom = true
this.validateFrom = true;
}
injectValidation() {
@@ -426,17 +426,22 @@ export class ExpedientTaskModalPage implements OnInit {
}
}
try {
this.taskResult = await this.despachoService.createDespacho(this.postData).toPromise();
await this.toastService.successMessage('Processo efetuado');
this.modalController.dismiss(action_despacho_pr);
} catch (error) {
await this.toastService.badRequest('Processo não efetuado')
} finally {
loader.remove()
}
if(this.postData.DispatchFolder.Message){
try {
this.taskResult = await this.despachoService.createDespacho(this.postData).toPromise();
await this.toastService.successMessage('Processo efetuado');
this.modalController.dismiss(action_despacho_pr);
} catch (error) {
console.log('this.taskResult', this.taskResult);
await this.toastService.badRequest('Processo não efetuado')
} finally {
//loader.remove()
}
}
else{
this.toastService.badRequest('Por favor adicione uma nota');
}
loader.remove();
break;
case '1': // parecer
@@ -459,24 +464,16 @@ export class ExpedientTaskModalPage implements OnInit {
}
}
if(this.postData.DispatchFolder.Message){
try {
try {
this.taskResult = await this.processes.postParecerPr(this.postData).toPromise();
await this.toastService.successMessage('Pedido enviado');
this.modalController.dismiss(action_parecer_pr);
} catch (error) {
this.taskResult = await this.processes.postParecerPr(this.postData).toPromise();
await this.toastService.successMessage('Pedido enviado');
this.modalController.dismiss(action_parecer_pr);
} catch (error) {
await this.toastService.badRequest('Processo não efetuado')
} finally {
//loader.remove()
}
await this.toastService.badRequest('Processo não efetuado')
} finally {
loader.remove()
}
else{
this.toastService.badRequest('Por favor adicione uma nota');
}
loader.remove();
break;
}
+7 -2
View File
@@ -9,6 +9,7 @@ import { AuthConnstants } from '../config/auth-constants';
import { AlertController } from '@ionic/angular';
import { SessionStore } from '../store/session.service';
import { AESEncrypt } from '../services/aesencrypt.service';
import { CookieService } from 'ngx-cookie-service';
@Injectable({
providedIn: 'root'
@@ -27,6 +28,7 @@ export class AuthService {
private storageService:StorageService,
public alertController: AlertController,
private aesencrypt: AESEncrypt,
private cookieService: CookieService,
) {
this.headers = new HttpHeaders();
@@ -102,8 +104,11 @@ export class AuthService {
console.log('Login to Rocket chat OK');
this.ValidatedUserChat = responseChat;
localStorage.setItem('userChat', JSON.stringify(responseChat));
localStorage.setItem('Meteor.loginToken', JSON.stringify(responseChat['data'].authToken));
localStorage.setItem('Meteor.userId', JSON.stringify(responseChat['data'].userId));
localStorage.setItem('Meteor.loginToken', responseChat['data'].authToken);
localStorage.setItem('Meteor.userId',responseChat['data'].userId);
this.cookieService.set('rc_token', responseChat['data'].authToken);
this.cookieService.set('rc_uid', responseChat['data'].userId);
alert(this.cookieService.get('rc_uid'));
this.storageService.store(AuthConnstants.AUTH, responseChat);
return true;
}