mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 12:37:53 +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 localePt from '@angular/common/locales/pt';
|
||||
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';
|
||||
|
||||
registerLocaleData(localePt, 'pt');
|
||||
@@ -369,7 +370,8 @@ registerLocaleData(localePt, 'pt');
|
||||
MatIconModule,
|
||||
// module
|
||||
ChatModule,
|
||||
UserModule
|
||||
UserModule,
|
||||
SessionExpiredModalPageModule
|
||||
],
|
||||
entryComponents: [
|
||||
DiplomaOptionsPage,
|
||||
|
||||
@@ -13,8 +13,8 @@ import { catchError, filter, take, switchMap, tap } from "rxjs/operators";
|
||||
import { SessionStore } from '../../../store/session.service';
|
||||
import { environment } from "src/environments/environment";
|
||||
import { Router } from "@angular/router";
|
||||
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
|
||||
import { Platform } from '@ionic/angular';
|
||||
import { SessionExpiredModalService } from 'src/app/services/session-expired-modal.service';
|
||||
import { UserLoginOutputResponse } from "../../../core/user/repository/user-remote-repository";
|
||||
|
||||
@Injectable()
|
||||
@@ -29,7 +29,7 @@ export class TokenInterceptor implements HttpInterceptor {
|
||||
constructor(
|
||||
private http: HttpClient,
|
||||
private router: Router,
|
||||
private httpErrorHandle: HttpErrorHandle,
|
||||
private sessionExpiredModal: SessionExpiredModalService,
|
||||
private platform: Platform) { }
|
||||
|
||||
|
||||
@@ -132,23 +132,19 @@ export class TokenInterceptor implements HttpInterceptor {
|
||||
}),
|
||||
catchError((error) => {
|
||||
console.log("refresh token error",error)
|
||||
// SessionStore.user.Authorization = SessionStore.user.Authorization;
|
||||
// SessionStore.user.RefreshToken = SessionStore.user.RefreshToken;
|
||||
SessionStore.setInativity(false)
|
||||
/* SessionStore.setUrlBeforeInactivity(this.router.url); */
|
||||
|
||||
if (environment.production) {
|
||||
window.location.pathname = '/auth'
|
||||
} else {
|
||||
const pathBeforeGoOut = window.location.pathname
|
||||
console.log('Before auth',window.location.pathname)
|
||||
this.router.navigateByUrl('/auth', { replaceUrl: true }).then(() =>{
|
||||
if(pathBeforeGoOut != "/auth") {
|
||||
this.httpErrorHandle.httpsSucessMessagge('sessonExpired')
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
const sessionExpiredMessage =
|
||||
'A sua sessão expirou. Por favor, faça login novamente para continuar.';
|
||||
const goToAuth = () => {
|
||||
if (environment.production) {
|
||||
window.location.pathname = '/auth';
|
||||
} else if (!this.router.url.startsWith('/auth')) {
|
||||
this.router.navigateByUrl('/auth', { replaceUrl: true });
|
||||
}
|
||||
};
|
||||
console.log('sessionExpiredModal', this.sessionExpiredModal)
|
||||
void this.sessionExpiredModal.present(sessionExpiredMessage, goToAuth);
|
||||
return of(false);
|
||||
})
|
||||
);
|
||||
|
||||
@@ -968,6 +968,19 @@ background: rgb(92, 92, 92);
|
||||
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{
|
||||
position: absolute;
|
||||
top: 23px;
|
||||
|
||||
Reference in New Issue
Block a user