add logout v2

This commit is contained in:
Peter Maquiran
2024-11-07 11:15:01 +01:00
parent 652252e478
commit dad392335e
7 changed files with 80 additions and 32 deletions
+5 -24
View File
@@ -19,6 +19,8 @@ import { NotificationTable } from 'src/app/module/notification/data/infra/db/not
import { isHttpError } from 'src/app/services/http.service';
import { UserRepositoryService } from 'src/app/module/user/data/user-repository.service';
import { UserProfilePicture } from 'src/app/module/user/data/datasource/user-local-repository.service';
import { UserService } from 'src/app/module/user/domain/user.service'
@Component({
selector: 'app-profile',
@@ -69,7 +71,8 @@ export class ProfilePage implements OnInit {
private agendaDataRepository: AgendaDataRepositoryService,
private toastService: ToastService,
private notificationRepositoryService: NotificationRepositoryService,
private UserRepositoryService: UserRepositoryService
private UserRepositoryService: UserRepositoryService,
private UserService:UserService
) {
this.profilePictureSubject = this.UserRepositoryService.getProfilePictureLive() as any
@@ -350,29 +353,7 @@ export class ProfilePage implements OnInit {
}
logout() {
this.authservice.logoutUser();
SessionStore.setInativity(false)
SessionStore.setUrlBeforeInactivity(this.router.url);
this.logoutOut == false
if (environment.production) {
window.location.pathname = '/auth'
this.notificationService.DeletePostToken()
} else {
const pathBeforeGoOut = window.location.pathname
this.router.navigateByUrl('/auth', { replaceUrl: true });
this.notificationService.DeletePostToken()
setTimeout(() => {
if (this.logoutOut == false || pathBeforeGoOut == window.location.pathname) {
window.location.pathname = '/auth'
this.notificationService.DeletePostToken()
} else {
}
}, 500)
}
this.UserService.logout();
}
async editProfile() {