Skip to content

Commit

Permalink
fix(home): do not redirect to read page if view did leave
Browse files Browse the repository at this point in the history
  • Loading branch information
robingenz committed Aug 16, 2024
1 parent 2a64496 commit 26ccae1
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/app/modules/home/pages/home/home.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
RouterService,
} from '@app/core';
import { ViewDidEnter, ViewDidLeave } from '@ionic/angular';
import { skipWhile } from 'rxjs';

@Component({
selector: 'app-home',
Expand All @@ -27,13 +26,14 @@ export class HomePage implements OnInit, ViewDidEnter, ViewDidLeave {
) {}

public ngOnInit(): void {
this.nfcService.lastScannedTag$
.pipe(skipWhile(() => this.viewDidLeave))
.subscribe(() => {
void this.routerService.navigateToReadPage({
showLastScannedTag: true,
});
this.nfcService.lastScannedTag$.subscribe(() => {
if (this.viewDidLeave) {
return;
}
void this.routerService.navigateToReadPage({
showLastScannedTag: true,
});
});
}

public ionViewDidEnter(): void {
Expand Down

0 comments on commit 26ccae1

Please sign in to comment.