Skip to content

Commit

Permalink
redirecting the advisor account to the pending requests page
Browse files Browse the repository at this point in the history
  • Loading branch information
rusudinu committed Apr 2, 2024
1 parent 9e9aa1d commit e3cc459
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/app/layouts/dashboard/dashboard.component.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { AsyncPipe, DatePipe, KeyValuePipe, NgForOf, NgIf } from '@angular/common';
import { Component, inject } from '@angular/core';
import { Component, inject, OnInit } from '@angular/core';
import { MatButton } from '@angular/material/button';
import { MatDialog } from '@angular/material/dialog';
import { Router } from '@angular/router';
import { Store } from '@ngrx/store';
import { map } from 'rxjs';

Expand All @@ -18,9 +19,10 @@ import { ETransactionType, ITransaction } from '../transfer/common/transaction.i
templateUrl: './dashboard.component.html',
styleUrl: './dashboard.component.scss',
})
export class DashboardComponent {
export class DashboardComponent implements OnInit {
store: Store<IAppState> = inject(Store);
dialog: MatDialog = inject(MatDialog);
router: Router = inject(Router);
userData$ = this.store.select(selectUser);
totalBalance$ = this.userData$.pipe(
map(user =>
Expand Down Expand Up @@ -88,6 +90,14 @@ export class DashboardComponent {
}),
);

ngOnInit() {
this.userData$.subscribe(user => {
if (user.advisorAccount) {
this.router.navigate(['pending-requests']).then();
}
});
}

openRequestAdvisorModal(): void {
this.dialog.open(RequestAdvisorModalComponent, {
maxHeight: '80%',
Expand Down

0 comments on commit e3cc459

Please sign in to comment.