mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 12:37:53 +00:00
add redirect message
This commit is contained in:
@@ -292,6 +292,10 @@ const routes = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'popup-question',
|
path: 'popup-question',
|
||||||
|
loadChildren: () => import('./modals/popup-question/popup-question.module').then( m => m.PopupQuestionPageModule)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'not-found',
|
||||||
loadChildren: () => import('./pages/not-found/not-found.module').then( m => m.NotFoundPageModule)
|
loadChildren: () => import('./pages/not-found/not-found.module').then( m => m.NotFoundPageModule)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
import { TestBed } from '@angular/core/testing';
|
|
||||||
|
|
||||||
import { MiddlewareRemoteDatasourcecService } from './middleware-remote-datasourcec.service';
|
|
||||||
|
|
||||||
describe('MiddlewareRemoteDatasourcecService', () => {
|
|
||||||
let service: MiddlewareRemoteDatasourcecService;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
TestBed.configureTestingModule({});
|
|
||||||
service = TestBed.inject(MiddlewareRemoteDatasourcecService);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should be created', () => {
|
|
||||||
expect(service).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
import { Injectable } from '@angular/core';
|
|
||||||
import { SessionStore } from "src/app/store/session.service"
|
|
||||||
import { MiddlewareServiceService } from "src/app/shared/API/middleware/middleware-service.service"
|
|
||||||
@Injectable({
|
|
||||||
providedIn: 'root'
|
|
||||||
})
|
|
||||||
export class MiddlewareRemoteDatasourcecService {
|
|
||||||
|
|
||||||
constructor(
|
|
||||||
private MiddlewareServiceService: MiddlewareServiceService,
|
|
||||||
) {}
|
|
||||||
|
|
||||||
refreshToken() {
|
|
||||||
const refreshToken = SessionStore.user.Authorization
|
|
||||||
return this.MiddlewareServiceService.refreshToken(refreshToken)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -414,7 +414,10 @@ const routes: Routes = [
|
|||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
{ path: '**', redirectTo: '/', pathMatch: 'full' },
|
{
|
||||||
|
path: '**',
|
||||||
|
loadChildren: ()=> import('../pages/not-found/not-found.module').then(m => m.NotFoundPageModule),
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ export class EventsPage implements OnInit {
|
|||||||
private changeProfileService: ChangeProfileService,
|
private changeProfileService: ChangeProfileService,
|
||||||
public TaskService: TaskService
|
public TaskService: TaskService
|
||||||
) {
|
) {
|
||||||
|
|
||||||
window['zipPhoneCallback'] = function (zipphone) {
|
window['zipPhoneCallback'] = function (zipphone) {
|
||||||
var frame = document.getElementById('home-iframe');
|
var frame = document.getElementById('home-iframe');
|
||||||
if(frame) {
|
if(frame) {
|
||||||
@@ -113,7 +113,7 @@ export class EventsPage implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ngAfterViewInit(): void {
|
ngAfterViewInit(): void {
|
||||||
|
|
||||||
|
|
||||||
this.loadAllTask();
|
this.loadAllTask();
|
||||||
|
|
||||||
@@ -123,9 +123,9 @@ export class EventsPage implements OnInit {
|
|||||||
this.dynamicSearch()
|
this.dynamicSearch()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
this.dynamicSearch()
|
this.dynamicSearch()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
ngOnDestroy() {
|
||||||
@@ -161,20 +161,20 @@ export class EventsPage implements OnInit {
|
|||||||
|
|
||||||
const ordinance = this.ordinance
|
const ordinance = this.ordinance
|
||||||
if(this.showSearch && this.searchSubject) {
|
if(this.showSearch && this.searchSubject) {
|
||||||
|
|
||||||
const AllProcess = this.TaskService.AllProcess.filter((task) => {
|
const AllProcess = this.TaskService.AllProcess.filter((task) => {
|
||||||
let subject = task.Folio || task.Subject || task.workflowInstanceDataFields.Subject
|
let subject = task.Folio || task.Subject || task.workflowInstanceDataFields.Subject
|
||||||
subject = subject.toLowerCase();
|
subject = subject.toLowerCase();
|
||||||
return subject.includes(this.searchSubject.toLowerCase())
|
return subject.includes(this.searchSubject.toLowerCase())
|
||||||
}).filter( task => this.TaskService.filter(task, this.filterName))
|
}).filter( task => this.TaskService.filter(task, this.filterName))
|
||||||
|
|
||||||
|
|
||||||
if(ordinance == this.ordinance) {
|
if(ordinance == this.ordinance) {
|
||||||
this.AllProcess = this.TaskService.reorderList(this.ordinance, AllProcess)
|
this.AllProcess = this.TaskService.reorderList(this.ordinance, AllProcess)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const AllProcess = this.TaskService.AllProcess
|
const AllProcess = this.TaskService.AllProcess
|
||||||
|
|
||||||
if(ordinance == this.ordinance) {
|
if(ordinance == this.ordinance) {
|
||||||
this.AllProcess = this.TaskService.reorderList(this.ordinance, AllProcess)
|
this.AllProcess = this.TaskService.reorderList(this.ordinance, AllProcess)
|
||||||
.filter( task => this.TaskService.filter(task, this.filterName))
|
.filter( task => this.TaskService.filter(task, this.filterName))
|
||||||
@@ -205,7 +205,7 @@ export class EventsPage implements OnInit {
|
|||||||
} catch(error) {}
|
} catch(error) {}
|
||||||
}, 2000);
|
}, 2000);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.RefreshEvents();
|
this.RefreshEvents();
|
||||||
this.LoadList();
|
this.LoadList();
|
||||||
this.loadAllTask();
|
this.loadAllTask();
|
||||||
@@ -218,7 +218,7 @@ export class EventsPage implements OnInit {
|
|||||||
|
|
||||||
|
|
||||||
async RefreshEvents() {
|
async RefreshEvents() {
|
||||||
|
|
||||||
this.currentEvent = "";
|
this.currentEvent = "";
|
||||||
this.showLoader = true;
|
this.showLoader = true;
|
||||||
this.showAgendaLoader = true;
|
this.showAgendaLoader = true;
|
||||||
@@ -256,7 +256,7 @@ export class EventsPage implements OnInit {
|
|||||||
let dateToday = date.getFullYear() + "-" + month + "-" + date.getDate();
|
let dateToday = date.getFullYear() + "-" + month + "-" + date.getDate();
|
||||||
|
|
||||||
this.storage.get('events').then((events: any[] = []) => {
|
this.storage.get('events').then((events: any[] = []) => {
|
||||||
//
|
//
|
||||||
|
|
||||||
if(Array.isArray(events)) {
|
if(Array.isArray(events)) {
|
||||||
this.listToPresent = events
|
this.listToPresent = events
|
||||||
@@ -271,7 +271,7 @@ export class EventsPage implements OnInit {
|
|||||||
} catch (error) {}
|
} catch (error) {}
|
||||||
|
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@@ -299,19 +299,19 @@ export class EventsPage implements OnInit {
|
|||||||
|
|
||||||
changeProfile() {
|
changeProfile() {
|
||||||
if (this.profile == "mdgpr") {
|
if (this.profile == "mdgpr") {
|
||||||
//
|
//
|
||||||
this.profile = "pr";
|
this.profile = "pr";
|
||||||
this.RefreshEvents();
|
this.RefreshEvents();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//
|
//
|
||||||
this.profile = "mdgpr";
|
this.profile = "mdgpr";
|
||||||
this.RefreshEvents();
|
this.RefreshEvents();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async openEventDetail1(id: any) {
|
async openEventDetail1(id: any) {
|
||||||
//
|
//
|
||||||
|
|
||||||
const modal = await this.modalController.create({
|
const modal = await this.modalController.create({
|
||||||
component: EventDetailPage,
|
component: EventDetailPage,
|
||||||
@@ -328,7 +328,7 @@ export class EventsPage implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async openEventDetail(id: any) {
|
async openEventDetail(id: any) {
|
||||||
//
|
//
|
||||||
|
|
||||||
const modal = await this.modalController.create({
|
const modal = await this.modalController.create({
|
||||||
component: ViewEventPage,
|
component: ViewEventPage,
|
||||||
@@ -338,7 +338,7 @@ export class EventsPage implements OnInit {
|
|||||||
cssClass: 'view-event',
|
cssClass: 'view-event',
|
||||||
backdropDismiss: false
|
backdropDismiss: false
|
||||||
});
|
});
|
||||||
|
|
||||||
modal.onDidDismiss();
|
modal.onDidDismiss();
|
||||||
await modal.present();
|
await modal.present();
|
||||||
|
|
||||||
@@ -358,7 +358,7 @@ export class EventsPage implements OnInit {
|
|||||||
window['all-process-gabinete']()
|
window['all-process-gabinete']()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sortArrayISODate(myArray: any) {
|
sortArrayISODate(myArray: any) {
|
||||||
@@ -375,9 +375,9 @@ export class EventsPage implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
goToAllTaskFilter(event: any) {
|
goToAllTaskFilter(event: any) {
|
||||||
let navigationExtras: NavigationExtras = { queryParams: {
|
let navigationExtras: NavigationExtras = { queryParams: {
|
||||||
filter: event,
|
filter: event,
|
||||||
processes: true
|
processes: true
|
||||||
} }
|
} }
|
||||||
|
|
||||||
|
|
||||||
@@ -407,4 +407,4 @@ export class EventsPage implements OnInit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { Routes, RouterModule } from '@angular/router';
|
||||||
|
|
||||||
|
import { NotFoundPage } from './not-found.page';
|
||||||
|
|
||||||
|
const routes: Routes = [
|
||||||
|
{
|
||||||
|
path: '',
|
||||||
|
component: NotFoundPage
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [RouterModule.forChild(routes)],
|
||||||
|
exports: [RouterModule],
|
||||||
|
})
|
||||||
|
export class NotFoundPageRoutingModule {}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
import { FormsModule } from '@angular/forms';
|
||||||
|
|
||||||
|
import { IonicModule } from '@ionic/angular';
|
||||||
|
|
||||||
|
import { NotFoundPageRoutingModule } from './not-found-routing.module';
|
||||||
|
|
||||||
|
import { NotFoundPage } from './not-found.page';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [
|
||||||
|
CommonModule,
|
||||||
|
FormsModule,
|
||||||
|
IonicModule,
|
||||||
|
NotFoundPageRoutingModule
|
||||||
|
],
|
||||||
|
declarations: [NotFoundPage]
|
||||||
|
})
|
||||||
|
export class NotFoundPageModule {}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
||||||
|
import { IonicModule } from '@ionic/angular';
|
||||||
|
|
||||||
|
import { NotFoundPage } from './not-found.page';
|
||||||
|
|
||||||
|
describe('NotFoundPage', () => {
|
||||||
|
let component: NotFoundPage;
|
||||||
|
let fixture: ComponentFixture<NotFoundPage>;
|
||||||
|
|
||||||
|
beforeEach(waitForAsync(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ NotFoundPage ],
|
||||||
|
imports: [IonicModule.forRoot()]
|
||||||
|
}).compileComponents();
|
||||||
|
|
||||||
|
fixture = TestBed.createComponent(NotFoundPage);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
}));
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
import { Router } from '@angular/router';
|
||||||
|
import { ToastService } from 'src/app/services/toast.service';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-not-found',
|
||||||
|
templateUrl: './not-found.page.html',
|
||||||
|
styleUrls: ['./not-found.page.scss'],
|
||||||
|
})
|
||||||
|
export class NotFoundPage implements OnInit {
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
private router: Router,
|
||||||
|
private toastService: ToastService,
|
||||||
|
) { }
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
this.router.navigate(['/home/events']);
|
||||||
|
this.toastService._badRequest("Página não encontrada")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
import { TestBed } from '@angular/core/testing';
|
|
||||||
|
|
||||||
import { MiddlewareRepositoryService } from './middleware-repository.service';
|
|
||||||
|
|
||||||
describe('MiddlewareRepositoryService', () => {
|
|
||||||
let service: MiddlewareRepositoryService;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
TestBed.configureTestingModule({});
|
|
||||||
service = TestBed.inject(MiddlewareRepositoryService);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should be created', () => {
|
|
||||||
expect(service).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
import { Injectable } from '@angular/core';
|
|
||||||
import { MiddlewareRemoteDatasourcecService } from "src/app/datasource/middleware/remote/middleware-remote-datasourcec.service";
|
|
||||||
@Injectable({
|
|
||||||
providedIn: 'root'
|
|
||||||
})
|
|
||||||
export class MiddlewareRepositoryService {
|
|
||||||
|
|
||||||
constructor(
|
|
||||||
private MiddlewareRemoteDatasourcecService: MiddlewareRemoteDatasourcecService,
|
|
||||||
) {}
|
|
||||||
|
|
||||||
refreshToken() {
|
|
||||||
return this.MiddlewareRemoteDatasourcecService.refreshToken()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
import { TestBed } from '@angular/core/testing';
|
|
||||||
|
|
||||||
import { TokenInterceptorService } from './token-interceptor.service';
|
|
||||||
|
|
||||||
describe('TokenInterceptorService', () => {
|
|
||||||
let service: TokenInterceptorService;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
TestBed.configureTestingModule({});
|
|
||||||
service = TestBed.inject(TokenInterceptorService);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should be created', () => {
|
|
||||||
expect(service).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -1,81 +0,0 @@
|
|||||||
import { Injectable } from "@angular/core";
|
|
||||||
import {
|
|
||||||
HttpRequest,
|
|
||||||
HttpHandler,
|
|
||||||
HttpEvent,
|
|
||||||
HttpInterceptor,
|
|
||||||
HttpErrorResponse,
|
|
||||||
HTTP_INTERCEPTORS,
|
|
||||||
} from "@angular/common/http";
|
|
||||||
import { Observable, throwError, BehaviorSubject } from "rxjs";
|
|
||||||
import { catchError, filter, take, switchMap } from "rxjs/operators";
|
|
||||||
import { SessionStore } from "src/app/store/session.service";
|
|
||||||
import { MiddlewareRepositoryService } from "src/app/repository/middleWare/middleware-repository.service"
|
|
||||||
|
|
||||||
@Injectable({
|
|
||||||
providedIn: 'root'
|
|
||||||
})
|
|
||||||
export class TokenInterceptorService {
|
|
||||||
|
|
||||||
private isRefreshing = false;
|
|
||||||
private refreshTokenSubject: BehaviorSubject<any> = new BehaviorSubject<any>(
|
|
||||||
null
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
constructor(private middlewareRepositoryService: MiddlewareRepositoryService) {
|
|
||||||
this.middlewareRepositoryService = middlewareRepositoryService
|
|
||||||
}
|
|
||||||
|
|
||||||
intercept(
|
|
||||||
request: HttpRequest<any>,
|
|
||||||
next: HttpHandler
|
|
||||||
): Observable<HttpEvent<any>> {
|
|
||||||
if (SessionStore.user.Authorization) {
|
|
||||||
request = this.addToken(request, SessionStore.user.Authorization);
|
|
||||||
}
|
|
||||||
|
|
||||||
return next.handle(request).pipe(
|
|
||||||
catchError((error) => {
|
|
||||||
if (error instanceof HttpErrorResponse && error.status === 401) {
|
|
||||||
return this.handle401Error(request, next);
|
|
||||||
} else {
|
|
||||||
return throwError(error);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
) as any
|
|
||||||
}
|
|
||||||
|
|
||||||
private addToken(request: HttpRequest<any>, token: string) {
|
|
||||||
return request.clone({
|
|
||||||
setHeaders: {
|
|
||||||
Authorization: `Bearer ${token}`,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private handle401Error(request: HttpRequest<any>, next: HttpHandler) {
|
|
||||||
if (!this.isRefreshing) {
|
|
||||||
this.isRefreshing = true;
|
|
||||||
this.refreshTokenSubject.next(null);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return this.middlewareRepositoryService.refreshToken().pipe(
|
|
||||||
switchMap((token: any) => {
|
|
||||||
this.isRefreshing = false;
|
|
||||||
this.refreshTokenSubject.next(token['result'].accessToken);
|
|
||||||
return next.handle(this.addToken(request, token['result'].accessToken));
|
|
||||||
})
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return this.refreshTokenSubject.pipe(
|
|
||||||
filter((token) => token != null),
|
|
||||||
take(1),
|
|
||||||
switchMap((jwt) => {
|
|
||||||
return next.handle(this.addToken(request, jwt));
|
|
||||||
})
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+1
-1
@@ -27,7 +27,7 @@
|
|||||||
<!-- same origin only -->
|
<!-- same origin only -->
|
||||||
<add name="Cross-Origin-Embedder-Policy" value="require-corp" />
|
<add name="Cross-Origin-Embedder-Policy" value="require-corp" />
|
||||||
<!-- same origin only -->
|
<!-- same origin only -->
|
||||||
<add name="Cross-Origin-Opener-Policy" value="same-origin" />
|
<!-- <add name="Cross-Origin-Opener-Policy" value="same-origin" /> -->
|
||||||
</customHeaders>
|
</customHeaders>
|
||||||
</httpProtocol>
|
</httpProtocol>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user