Skip to content

Commit

Permalink
fix: Deep link redirection fix (#3060)
Browse files Browse the repository at this point in the history
  • Loading branch information
bistaastha committed Jun 12, 2024
1 parent dcc31a5 commit 890a7f9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,6 @@ describe('DeepLinkRedirectionPage', () => {
fixture.detectChanges();
expect(loaderService.showLoader).toHaveBeenCalledOnceWith('Loading....');
tick(500);
expect(authService.getEou).toHaveBeenCalledTimes(1);
tick(500);
expect(spenderReportsService.getReportById).toHaveBeenCalledOnceWith(activeroutemock.snapshot.params.id);
expect(router.navigate).toHaveBeenCalledOnceWith([
'/',
Expand Down Expand Up @@ -148,8 +146,6 @@ describe('DeepLinkRedirectionPage', () => {
fixture.detectChanges();
expect(loaderService.showLoader).toHaveBeenCalledOnceWith('Loading....');
tick(500);
expect(authService.getEou).toHaveBeenCalledTimes(1);
tick(500);
expect(router.navigate).toHaveBeenCalledOnceWith([
'/',
'enterprise',
Expand Down
7 changes: 2 additions & 5 deletions src/app/deep-link-redirection/deep-link-redirection.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,9 @@ export class DeepLinkRedirectionPage {

async redirectToReportModule(): Promise<void> {
await this.loaderService.showLoader('Loading....');
const currentEou = await this.authService.getEou();

const spenderReport$ = this.spenderReportsService.getReportById(this.activatedRoute.snapshot.params.id as string);
const approverReport$ = this.approverReportsService.getReportById(this.activatedRoute.snapshot.params.id as string);
const rptObservables$ = [];
if (currentEou.ou.roles.includes('APPROVER')) {
rptObservables$.push(this.approverReportsService.getReportById(this.activatedRoute.snapshot.params.id as string));
}
spenderReport$.subscribe(
(spenderReport) => {
if (spenderReport) {
Expand All @@ -151,6 +146,8 @@ export class DeepLinkRedirectionPage {
'view_team_report',
{ id: this.activatedRoute.snapshot.params.id as string },
]);
} else {
this.switchOrg();
}
});
}
Expand Down

0 comments on commit 890a7f9

Please sign in to comment.