Merge pull request #7936 from jwangyangls/redirectToError

Fix issue  click members and logs tab in project detail page portal will redirect to projects list page when call API failed
This commit is contained in:
Wang Yan 2019-06-20 15:47:56 +08:00 committed by GitHub
commit 0798e0d795
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 5 deletions

View File

@ -31,6 +31,9 @@ export const errorHandler = function (error: any): string {
if (error.error && error.error.message) {
return error.error.message;
}
if (error.message) {
return error.message;
}
if (!(error.statusCode || error.status)) {
// treat as string message

View File

@ -104,7 +104,6 @@ export class AuditLogComponent implements OnInit {
this.auditLogs = response.body;
},
error => {
this.router.navigate(['/harbor', 'projects']);
this.messageHandlerService.handleError(error);
}
);

View File

@ -129,15 +129,16 @@ export class MemberComponent implements OnInit, OnDestroy {
this.selectedRow = [];
this.memberService
.listMembers(projectId, username).pipe(
finalize(() => this.loading = false))
finalize(() => {
this.loading = false;
let hnd = setInterval(() => this.ref.markForCheck(), 100);
setTimeout(() => clearInterval(hnd), 1000);
}))
.subscribe(
response => {
this.members = response;
let hnd = setInterval(() => this.ref.markForCheck(), 100);
setTimeout(() => clearInterval(hnd), 1000);
},
error => {
this.router.navigate(["/harbor", "projects"]);
this.messageHandlerService.handleError(error);
});
}