Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Mutugiii committed Jan 16, 2025
1 parent d8b8b33 commit 442e8c2
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 6 deletions.
1 change: 0 additions & 1 deletion src/app/home/home.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ export class HomeComponent implements OnInit, DoCheck, AfterViewChecked, OnDestr
private hasUnsavedChangesSubscription: Subscription;
hasUnsavedChanges = false;
private routerSubscription: Subscription;
private pendingNavigation: string;

constructor(
private couchService: CouchService,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Injectable } from '@angular/core';
import { CanDeactivate } from '@angular/router';
import { Observable } from 'rxjs';
import { CoursesAddComponent } from '../../courses/add-courses/courses-add.component';

export interface CanComponentDeactivate {
canDeactivate: () => Observable<boolean> | Promise<boolean> | boolean;
Expand All @@ -13,7 +12,6 @@ export interface CanComponentDeactivate {
export class UnsavedChangesGuard implements CanDeactivate<CanComponentDeactivate> {

canDeactivate(component: CanComponentDeactivate): Observable<boolean> | Promise<boolean> | boolean {
console.log('UnsavedChangesGuard triggered');
return component.canDeactivate ? component.canDeactivate() : true;
}
}
Expand Down
1 change: 0 additions & 1 deletion src/app/shared/unsaved-changes.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export class UnsavedChangesService {

setHasUnsavedChanges(hasChanges: boolean) {
this.unsavedChanges = hasChanges;
console.log('setHasUnsavedChanges called with:', hasChanges);
}

getHasUnsavedChanges(): boolean {
Expand Down
4 changes: 2 additions & 2 deletions src/app/users/users-update/users-update.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { StateService } from '../../shared/state.service';
import { ValidatorService } from '../../validators/validator.service';
import { showFormErrors } from '../../shared/table-helpers';
import { educationLevel } from '../user-constants';
import { CanComponentDeactivate } from '../../shared/guards/unsaved-changes.guard';
import { CanComponentDeactivate } from '../../shared/unsaved-changes.guard';
import { UnsavedChangesService } from '../../shared/unsaved-changes.service';
import { Subscription } from 'rxjs';

Expand Down Expand Up @@ -213,7 +213,7 @@ export class UsersUpdateComponent implements OnInit, CanComponentDeactivate {
}

removeImageFile() {
//required to prevent this from being called automatically when navigating away from the page
// required to prevent this from being called automatically when navigating away from the page
if (this.isNavigating) {
return;
}
Expand Down

0 comments on commit 442e8c2

Please sign in to comment.