Skip to content

Commit

Permalink
108915: Fixed issue that redirected you to 404 page when deleting the…
Browse files Browse the repository at this point in the history
… process on the process page
  • Loading branch information
alexandrevryghem committed Feb 8, 2024
1 parent c91b99f commit 252b367
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/app/process-page/detail/process-detail.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { HttpClient } from '@angular/common/http';
import { Component, Inject, NgZone, OnInit, PLATFORM_ID } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { BehaviorSubject, Observable } from 'rxjs';
import { finalize, map, switchMap, take, tap, find, startWith } from 'rxjs/operators';
import { finalize, map, switchMap, take, tap, find, startWith, filter } from 'rxjs/operators';
import { AuthService } from '../../core/auth/auth.service';
import { DSONameService } from '../../core/breadcrumbs/dso-name.service';
import { BitstreamDataService } from '../../core/data/bitstream-data.service';
Expand Down Expand Up @@ -80,6 +80,8 @@ export class ProcessDetailComponent implements OnInit {

isRefreshing$: Observable<boolean>;

isDeleting: boolean;

/**
* Reference to NgbModal
*/
Expand Down Expand Up @@ -113,6 +115,7 @@ export class ProcessDetailComponent implements OnInit {
return [data.process as RemoteData<Process>];
}
}),
filter(() => !this.isDeleting),
redirectOn4xx(this.router, this.authService),
);

Expand Down Expand Up @@ -203,15 +206,17 @@ export class ProcessDetailComponent implements OnInit {
* @param process
*/
deleteProcess(process: Process) {
this.isDeleting = true;
this.processService.delete(process.processId).pipe(
getFirstCompletedRemoteData()
).subscribe((rd) => {
if (rd.hasSucceeded) {
this.notificationsService.success(this.translateService.get('process.detail.delete.success'));
this.closeModal();
this.router.navigateByUrl(getProcessListRoute());
void this.router.navigateByUrl(getProcessListRoute());
} else {
this.notificationsService.error(this.translateService.get('process.detail.delete.error'));
this.isDeleting = false;
}
});
}
Expand Down

0 comments on commit 252b367

Please sign in to comment.