Skip to content

Commit

Permalink
fix(user): deletion didn't go through
Browse files Browse the repository at this point in the history
  • Loading branch information
kdinev committed Sep 17, 2024
1 parent b02d3cc commit 62c0146
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion projects/common/src/lib/login/login.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ <h4 class="igx-card-header__subtitle">{{ authUser.csgoDetails?.realName || authU
</igx-tab-header>
<igx-tab-content class="profile-content">

<bg-user-preferences></bg-user-preferences>
<bg-user-preferences (userDeleted)="close()"></bg-user-preferences>
</igx-tab-content>
</igx-tab-item>
</igx-tabs>
Expand Down
6 changes: 5 additions & 1 deletion projects/common/src/lib/login/login.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ export class LoginComponent {
}

public logout() {
this.authManager.logout().subscribe(() => this.userProfile.close());
this.authManager.logout().subscribe(() => this.close());
}

public close() {
this.userProfile.close();
}

public navigateToProfile(id: string) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component } from '@angular/core';
import { Component, EventEmitter, Output } from '@angular/core';
import { UserPreferences, ApplicationUser } from '../../../models/applicationuser';
import { LoginService } from '../../../services/login.service';
import { LoginProvider } from '../../../models/login-provider';
Expand Down Expand Up @@ -48,6 +48,9 @@ export class UserPreferencesComponent {
public authUser: ApplicationUser;
public registrations: TournamentApplication [];

@Output()
public userDeleted = new EventEmitter<void>();

constructor(private authManager: LoginService, private apiService: ApiTournamentsService, private router: Router) {
this.authManager.applicationUser.subscribe(user => {
if (user) {
Expand All @@ -74,6 +77,9 @@ export class UserPreferencesComponent {

public deleteAccount() {
this.authManager.deleteAccount(this.authUser.id).subscribe({
next: () => {
this.userDeleted.emit();
},
error: () => {}
});
}
Expand Down

0 comments on commit 62c0146

Please sign in to comment.