mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
call sesstion exparation model
This commit is contained in:
@@ -88,6 +88,7 @@ import { ChatModule } from './module/chat/chat.module';
|
|||||||
import { registerLocaleData } from '@angular/common';
|
import { registerLocaleData } from '@angular/common';
|
||||||
import localePt from '@angular/common/locales/pt';
|
import localePt from '@angular/common/locales/pt';
|
||||||
import { UserModule } from './module/user/user.module';
|
import { UserModule } from './module/user/user.module';
|
||||||
|
import { SessionExpiredModalPageModule } from './modals/session-expired-modal/session-expired-modal.module';
|
||||||
import { Logger } from './services/logger/main/service';
|
import { Logger } from './services/logger/main/service';
|
||||||
|
|
||||||
registerLocaleData(localePt, 'pt');
|
registerLocaleData(localePt, 'pt');
|
||||||
@@ -369,7 +370,8 @@ registerLocaleData(localePt, 'pt');
|
|||||||
MatIconModule,
|
MatIconModule,
|
||||||
// module
|
// module
|
||||||
ChatModule,
|
ChatModule,
|
||||||
UserModule
|
UserModule,
|
||||||
|
SessionExpiredModalPageModule
|
||||||
],
|
],
|
||||||
entryComponents: [
|
entryComponents: [
|
||||||
DiplomaOptionsPage,
|
DiplomaOptionsPage,
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ import { catchError, filter, take, switchMap, tap } from "rxjs/operators";
|
|||||||
import { SessionStore } from '../../../store/session.service';
|
import { SessionStore } from '../../../store/session.service';
|
||||||
import { environment } from "src/environments/environment";
|
import { environment } from "src/environments/environment";
|
||||||
import { Router } from "@angular/router";
|
import { Router } from "@angular/router";
|
||||||
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
|
|
||||||
import { Platform } from '@ionic/angular';
|
import { Platform } from '@ionic/angular';
|
||||||
|
import { SessionExpiredModalService } from 'src/app/services/session-expired-modal.service';
|
||||||
import { UserLoginOutputResponse } from "../../../core/user/repository/user-remote-repository";
|
import { UserLoginOutputResponse } from "../../../core/user/repository/user-remote-repository";
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
@@ -29,7 +29,7 @@ export class TokenInterceptor implements HttpInterceptor {
|
|||||||
constructor(
|
constructor(
|
||||||
private http: HttpClient,
|
private http: HttpClient,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private httpErrorHandle: HttpErrorHandle,
|
private sessionExpiredModal: SessionExpiredModalService,
|
||||||
private platform: Platform) { }
|
private platform: Platform) { }
|
||||||
|
|
||||||
|
|
||||||
@@ -132,23 +132,19 @@ export class TokenInterceptor implements HttpInterceptor {
|
|||||||
}),
|
}),
|
||||||
catchError((error) => {
|
catchError((error) => {
|
||||||
console.log("refresh token error",error)
|
console.log("refresh token error",error)
|
||||||
// SessionStore.user.Authorization = SessionStore.user.Authorization;
|
|
||||||
// SessionStore.user.RefreshToken = SessionStore.user.RefreshToken;
|
|
||||||
SessionStore.setInativity(false)
|
SessionStore.setInativity(false)
|
||||||
/* SessionStore.setUrlBeforeInactivity(this.router.url); */
|
|
||||||
|
|
||||||
if (environment.production) {
|
const sessionExpiredMessage =
|
||||||
window.location.pathname = '/auth'
|
'A sua sessão expirou. Por favor, faça login novamente para continuar.';
|
||||||
} else {
|
const goToAuth = () => {
|
||||||
const pathBeforeGoOut = window.location.pathname
|
if (environment.production) {
|
||||||
console.log('Before auth',window.location.pathname)
|
window.location.pathname = '/auth';
|
||||||
this.router.navigateByUrl('/auth', { replaceUrl: true }).then(() =>{
|
} else if (!this.router.url.startsWith('/auth')) {
|
||||||
if(pathBeforeGoOut != "/auth") {
|
this.router.navigateByUrl('/auth', { replaceUrl: true });
|
||||||
this.httpErrorHandle.httpsSucessMessagge('sessonExpired')
|
}
|
||||||
}
|
};
|
||||||
|
console.log('sessionExpiredModal', this.sessionExpiredModal)
|
||||||
})
|
void this.sessionExpiredModal.present(sessionExpiredMessage, goToAuth);
|
||||||
}
|
|
||||||
return of(false);
|
return of(false);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -968,6 +968,19 @@ background: rgb(92, 92, 92);
|
|||||||
display: none !important;
|
display: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ion-modal.session-expired-modal-blocking {
|
||||||
|
--width: 100%;
|
||||||
|
--height: 100%;
|
||||||
|
--max-width: 100%;
|
||||||
|
--max-height: 100%;
|
||||||
|
--border-radius: 0;
|
||||||
|
--backdrop-opacity: 0.55;
|
||||||
|
}
|
||||||
|
|
||||||
|
ion-modal.session-expired-modal-blocking::part(content) {
|
||||||
|
--background: var(--ion-background-color, #fff);
|
||||||
|
}
|
||||||
|
|
||||||
.notification{
|
.notification{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 23px;
|
top: 23px;
|
||||||
|
|||||||
Reference in New Issue
Block a user