Skip to content

Commit 6d4e765

Browse files
committed
No errors on /profile/history for user without account #10614 #12550
A user without account, or a user with account with no transaction, will see the exact same thing on /profile/history
1 parent 7133a6f commit 6d4e765

1 file changed

Lines changed: 13 additions & 6 deletions

File tree

client/app/profile/components/history/history.component.ts

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
} from '@angular/material/table';
1818
import {DatePipe} from '@angular/common';
1919
import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
20+
import {of} from 'rxjs';
2021

2122
@Component({
2223
selector: 'app-history',
@@ -50,11 +51,17 @@ export class HistoryComponent implements OnInit {
5051
public ngOnInit(): void {
5152
this.viewer = this.route.snapshot.data.viewer;
5253

53-
if (this.viewer.account) {
54-
const transactionLinesQuery = this.transactionLineService
55-
.getForAccount(this.viewer.account)
56-
.pipe(takeUntilDestroyed(this.destroyRef));
57-
this.dataSource = new NaturalDataSource<TransactionLinesQuery['transactionLines']>(transactionLinesQuery);
58-
}
54+
const transactionLinesQuery = this.viewer.account
55+
? this.transactionLineService.getForAccount(this.viewer.account).pipe(takeUntilDestroyed(this.destroyRef))
56+
: of({
57+
__typename: 'TransactionLinePagination',
58+
pageSize: 0,
59+
pageIndex: 0,
60+
length: 0,
61+
totalBalance: null,
62+
items: [],
63+
} satisfies TransactionLinesQuery['transactionLines']);
64+
65+
this.dataSource = new NaturalDataSource<TransactionLinesQuery['transactionLines']>(transactionLinesQuery);
5966
}
6067
}

0 commit comments

Comments
 (0)