Browse Source

Removed comments and refactor code

pull/6130/head
omkarg01 1 week ago
parent
commit
ce3823b0b3
  1. 13
      apps/client/src/app/pages/accounts/create-or-update-account-dialog/create-or-update-account-dialog.component.ts
  2. 8
      apps/client/src/app/services/data.service.ts

13
apps/client/src/app/pages/accounts/create-or-update-account-dialog/create-or-update-account-dialog.component.ts

@ -81,22 +81,23 @@ export class GfCreateOrUpdateAccountDialogComponent implements OnDestroy {
currency: [this.data.account.currency, Validators.required],
isExcluded: [this.data.account.isExcluded],
name: [this.data.account.name, Validators.required],
platformId: [null, this.autocompleteObjectValidator()] // Initialize as null
platformId: [null, this.autocompleteObjectValidator()]
});
this.dataService.fetchPlatforms().subscribe(({ platforms }) => {
this.platforms = platforms;
// Update platformId after platforms are loaded
const selectedPlatform = this.platforms.find(({ id }) => {
return id === this.data.account.platformId;
});
this.accountForm.patchValue({
platformId: selectedPlatform
});
this.accountForm.patchValue(
{
platformId: selectedPlatform
},
{ emitEvent: false }
);
// Set up filteredPlatforms observable
this.filteredPlatforms = this.accountForm
.get('platformId')
.valueChanges.pipe(

8
apps/client/src/app/services/data.service.ts

@ -198,10 +198,6 @@ export class DataService {
);
}
public fetchPlatforms(): Observable<PlatformsResponse> {
return this.http.get<PlatformsResponse>('/api/v1/platforms');
}
public fetchAccounts({ filters }: { filters?: Filter[] } = {}) {
const params = this.buildFiltersAsQueryParams({ filters });
@ -526,6 +522,10 @@ export class DataService {
);
}
public fetchPlatforms() {
return this.http.get<PlatformsResponse>('/api/v1/platforms');
}
public fetchPortfolioDetails({
filters,
withMarkets = false

Loading…
Cancel
Save