diff --git a/apps/client/src/app/components/admin-platform/admin-platform.component.ts b/apps/client/src/app/components/admin-platform/admin-platform.component.ts index 5645e7365..8a2004f8d 100644 --- a/apps/client/src/app/components/admin-platform/admin-platform.component.ts +++ b/apps/client/src/app/components/admin-platform/admin-platform.component.ts @@ -143,7 +143,7 @@ export class AdminPlatformComponent implements OnInit, OnDestroy { dialogRef .afterClosed() .pipe(takeUntil(this.unsubscribeSubject)) - .subscribe((platform: CreatePlatformDto) => { + .subscribe((platform: CreatePlatformDto | null) => { if (platform) { this.adminService .postPlatform(platform) @@ -180,7 +180,7 @@ export class AdminPlatformComponent implements OnInit, OnDestroy { dialogRef .afterClosed() .pipe(takeUntil(this.unsubscribeSubject)) - .subscribe((platform: UpdatePlatformDto) => { + .subscribe((platform: UpdatePlatformDto | null) => { if (platform) { this.adminService .putPlatform(platform) diff --git a/apps/client/src/app/components/admin-platform/create-or-update-platform-dialog/create-or-update-platform-dialog.component.ts b/apps/client/src/app/components/admin-platform/create-or-update-platform-dialog/create-or-update-platform-dialog.component.ts index 18354c942..518b6dd52 100644 --- a/apps/client/src/app/components/admin-platform/create-or-update-platform-dialog/create-or-update-platform-dialog.component.ts +++ b/apps/client/src/app/components/admin-platform/create-or-update-platform-dialog/create-or-update-platform-dialog.component.ts @@ -23,6 +23,7 @@ import { CreateOrUpdatePlatformDialogParams } from './interfaces/interfaces'; }) export class CreateOrUpdatePlatformDialog implements OnDestroy { public platformForm: FormGroup; + private unsubscribeSubject = new Subject(); public constructor( @@ -36,6 +37,10 @@ export class CreateOrUpdatePlatformDialog implements OnDestroy { }); } + public onCancel() { + this.dialogRef.close(); + } + public async onSubmit() { try { const platform: CreatePlatformDto | UpdatePlatformDto = { @@ -64,10 +69,6 @@ export class CreateOrUpdatePlatformDialog implements OnDestroy { } } - public onCancel() { - this.dialogRef.close(); - } - public ngOnDestroy() { this.unsubscribeSubject.next(); this.unsubscribeSubject.complete(); diff --git a/apps/client/src/app/components/admin-tag/admin-tag.component.ts b/apps/client/src/app/components/admin-tag/admin-tag.component.ts index edfccfcb0..5b5d5aa84 100644 --- a/apps/client/src/app/components/admin-tag/admin-tag.component.ts +++ b/apps/client/src/app/components/admin-tag/admin-tag.component.ts @@ -142,7 +142,7 @@ export class AdminTagComponent implements OnInit, OnDestroy { dialogRef .afterClosed() .pipe(takeUntil(this.unsubscribeSubject)) - .subscribe((tag: CreateTagDto) => { + .subscribe((tag: CreateTagDto | null) => { if (tag) { this.adminService .postTag(tag) @@ -178,7 +178,7 @@ export class AdminTagComponent implements OnInit, OnDestroy { dialogRef .afterClosed() .pipe(takeUntil(this.unsubscribeSubject)) - .subscribe((tag: UpdateTagDto) => { + .subscribe((tag: UpdateTagDto | null) => { if (tag) { this.adminService .putTag(tag) diff --git a/apps/client/src/app/components/admin-tag/create-or-update-tag-dialog/create-or-update-tag-dialog.component.ts b/apps/client/src/app/components/admin-tag/create-or-update-tag-dialog/create-or-update-tag-dialog.component.ts index a78e6e84e..f50974358 100644 --- a/apps/client/src/app/components/admin-tag/create-or-update-tag-dialog/create-or-update-tag-dialog.component.ts +++ b/apps/client/src/app/components/admin-tag/create-or-update-tag-dialog/create-or-update-tag-dialog.component.ts @@ -23,6 +23,7 @@ import { CreateOrUpdateTagDialogParams } from './interfaces/interfaces'; }) export class CreateOrUpdateTagDialog implements OnDestroy { public tagForm: FormGroup; + private unsubscribeSubject = new Subject(); public constructor( @@ -35,6 +36,10 @@ export class CreateOrUpdateTagDialog implements OnDestroy { }); } + public onCancel() { + this.dialogRef.close(); + } + public async onSubmit() { try { const tag: CreateTagDto | UpdateTagDto = { @@ -62,10 +67,6 @@ export class CreateOrUpdateTagDialog implements OnDestroy { } } - public onCancel() { - this.dialogRef.close(); - } - public ngOnDestroy() { this.unsubscribeSubject.next(); this.unsubscribeSubject.complete(); diff --git a/apps/client/src/app/components/user-account-access/create-or-update-access-dialog/create-or-update-access-dialog.component.ts b/apps/client/src/app/components/user-account-access/create-or-update-access-dialog/create-or-update-access-dialog.component.ts index cfb1207dc..f958a2f02 100644 --- a/apps/client/src/app/components/user-account-access/create-or-update-access-dialog/create-or-update-access-dialog.component.ts +++ b/apps/client/src/app/components/user-account-access/create-or-update-access-dialog/create-or-update-access-dialog.component.ts @@ -93,7 +93,7 @@ export class CreateOrUpdateAccessDialog implements OnDestroy { takeUntil(this.unsubscribeSubject) ) .subscribe(() => { - this.dialogRef.close({ access }); + this.dialogRef.close(access); }); } catch (error) { console.error(error); diff --git a/apps/client/src/app/components/user-account-access/user-account-access.component.ts b/apps/client/src/app/components/user-account-access/user-account-access.component.ts index 380a03700..b2ee5ae59 100644 --- a/apps/client/src/app/components/user-account-access/user-account-access.component.ts +++ b/apps/client/src/app/components/user-account-access/user-account-access.component.ts @@ -1,3 +1,4 @@ +import { CreateAccessDto } from '@ghostfolio/api/app/access/create-access.dto'; import { DataService } from '@ghostfolio/client/services/data.service'; import { UserService } from '@ghostfolio/client/services/user/user.service'; import { Access, User } from '@ghostfolio/common/interfaces'; @@ -113,7 +114,7 @@ export class UserAccountAccessComponent implements OnDestroy, OnInit { width: this.deviceType === 'mobile' ? '100vw' : '50rem' }); - dialogRef.afterClosed().subscribe((access) => { + dialogRef.afterClosed().subscribe((access: CreateAccessDto | null) => { if (access) { this.update(); } diff --git a/apps/client/src/app/pages/accounts/accounts-page.component.ts b/apps/client/src/app/pages/accounts/accounts-page.component.ts index e1b53acd3..e445863b4 100644 --- a/apps/client/src/app/pages/accounts/accounts-page.component.ts +++ b/apps/client/src/app/pages/accounts/accounts-page.component.ts @@ -189,9 +189,7 @@ export class AccountsPageComponent implements OnDestroy, OnInit { dialogRef .afterClosed() .pipe(takeUntil(this.unsubscribeSubject)) - .subscribe((data: any) => { - const account: UpdateAccountDto = data?.account; - + .subscribe((account: UpdateAccountDto | null) => { if (account) { this.dataService .putAccount(account) @@ -258,9 +256,7 @@ export class AccountsPageComponent implements OnDestroy, OnInit { dialogRef .afterClosed() .pipe(takeUntil(this.unsubscribeSubject)) - .subscribe((data: any) => { - const account: CreateAccountDto = data?.account; - + .subscribe((account: CreateAccountDto | null) => { if (account) { this.dataService .postAccount(account) diff --git a/apps/client/src/app/pages/accounts/create-or-update-account-dialog/create-or-update-account-dialog.component.ts b/apps/client/src/app/pages/accounts/create-or-update-account-dialog/create-or-update-account-dialog.component.ts index 6c3624344..91e0769fc 100644 --- a/apps/client/src/app/pages/accounts/create-or-update-account-dialog/create-or-update-account-dialog.component.ts +++ b/apps/client/src/app/pages/accounts/create-or-update-account-dialog/create-or-update-account-dialog.component.ts @@ -123,6 +123,8 @@ export class CreateOrUpdateAccountDialog implements OnDestroy { form: this.accountForm, object: account }); + + this.dialogRef.close(account as UpdateAccountDto); } else { delete (account as CreateAccountDto).id; @@ -131,9 +133,9 @@ export class CreateOrUpdateAccountDialog implements OnDestroy { form: this.accountForm, object: account }); - } - this.dialogRef.close({ account }); + this.dialogRef.close(account as CreateAccountDto); + } } catch (error) { console.error(error); } diff --git a/apps/client/src/app/pages/portfolio/activities/activities-page.component.ts b/apps/client/src/app/pages/portfolio/activities/activities-page.component.ts index 190fc673e..f6f0feded 100644 --- a/apps/client/src/app/pages/portfolio/activities/activities-page.component.ts +++ b/apps/client/src/app/pages/portfolio/activities/activities-page.component.ts @@ -287,9 +287,7 @@ export class ActivitiesPageComponent implements OnDestroy, OnInit { dialogRef .afterClosed() .pipe(takeUntil(this.unsubscribeSubject)) - .subscribe((data: any) => { - const transaction: UpdateOrderDto = data?.activity; - + .subscribe((transaction: UpdateOrderDto | null) => { if (transaction) { this.dataService .putOrder(transaction) @@ -338,9 +336,7 @@ export class ActivitiesPageComponent implements OnDestroy, OnInit { dialogRef .afterClosed() .pipe(takeUntil(this.unsubscribeSubject)) - .subscribe((data: any) => { - const transaction: CreateOrderDto = data?.activity; - + .subscribe((transaction: CreateOrderDto | null) => { if (transaction) { this.dataService.postOrder(transaction).subscribe({ next: () => { diff --git a/apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.component.ts b/apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.component.ts index 700e997e1..f49860028 100644 --- a/apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.component.ts +++ b/apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.component.ts @@ -475,6 +475,8 @@ export class CreateOrUpdateActivityDialog implements OnDestroy { ignoreFields: ['dataSource', 'date'], object: activity as UpdateOrderDto }); + + this.dialogRef.close(activity as UpdateOrderDto); } else { (activity as CreateOrderDto).updateAccountBalance = this.activityForm.get('updateAccountBalance').value; @@ -485,9 +487,9 @@ export class CreateOrUpdateActivityDialog implements OnDestroy { ignoreFields: ['dataSource', 'date'], object: activity }); - } - this.dialogRef.close({ activity }); + this.dialogRef.close(activity as CreateOrderDto); + } } catch (error) { console.error(error); }