Spaces:
Running
Running
Update flare-ui/src/app/components/user-info/user-info.component.ts
Browse files
flare-ui/src/app/components/user-info/user-info.component.ts
CHANGED
@@ -1,14 +1,15 @@
|
|
1 |
import { Component, inject } from '@angular/core';
|
2 |
import { CommonModule } from '@angular/common';
|
3 |
import { FormsModule } from '@angular/forms';
|
|
|
4 |
import { MatFormFieldModule } from '@angular/material/form-field';
|
5 |
import { MatInputModule } from '@angular/material/input';
|
6 |
import { MatButtonModule } from '@angular/material/button';
|
7 |
import { MatIconModule } from '@angular/material/icon';
|
8 |
import { MatProgressBarModule } from '@angular/material/progress-bar';
|
9 |
-
import { MatCardModule } from '@angular/material/card';
|
10 |
-
import { MatSnackBar, MatSnackBarModule } from '@angular/material/snack-bar';
|
11 |
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
|
|
12 |
import { ApiService } from '../../services/api.service';
|
13 |
import { AuthService } from '../../services/auth.service';
|
14 |
|
@@ -25,7 +26,7 @@ import { AuthService } from '../../services/auth.service';
|
|
25 |
MatProgressBarModule,
|
26 |
MatCardModule,
|
27 |
MatSnackBarModule,
|
28 |
-
MatProgressSpinnerModule
|
29 |
],
|
30 |
templateUrl: './user-info.component.html',
|
31 |
styleUrls: ['./user-info.component.scss']
|
@@ -34,6 +35,7 @@ export class UserInfoComponent {
|
|
34 |
private apiService = inject(ApiService);
|
35 |
private authService = inject(AuthService);
|
36 |
private snackBar = inject(MatSnackBar);
|
|
|
37 |
|
38 |
username = this.authService.getUsername() || '';
|
39 |
currentPassword = '';
|
@@ -103,11 +105,12 @@ export class UserInfoComponent {
|
|
103 |
this.currentPassword = '';
|
104 |
this.newPassword = '';
|
105 |
this.confirmPassword = '';
|
106 |
-
|
107 |
// Navigate to projects tab after successful password change
|
108 |
setTimeout(() => {
|
109 |
this.router.navigate(['/projects']);
|
110 |
}, 500);
|
|
|
111 |
} catch (error: any) {
|
112 |
const message = error.error?.detail || 'Failed to change password';
|
113 |
this.snackBar.open(message, 'Close', { duration: 5000 });
|
|
|
1 |
import { Component, inject } from '@angular/core';
|
2 |
import { CommonModule } from '@angular/common';
|
3 |
import { FormsModule } from '@angular/forms';
|
4 |
+
import { Router } from '@angular/router';
|
5 |
import { MatFormFieldModule } from '@angular/material/form-field';
|
6 |
import { MatInputModule } from '@angular/material/input';
|
7 |
import { MatButtonModule } from '@angular/material/button';
|
8 |
import { MatIconModule } from '@angular/material/icon';
|
9 |
import { MatProgressBarModule } from '@angular/material/progress-bar';
|
10 |
+
import { MatCardModule } from '@angular/material/card';
|
|
|
11 |
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
12 |
+
import { MatSnackBar, MatSnackBarModule } from '@angular/material/snack-bar';
|
13 |
import { ApiService } from '../../services/api.service';
|
14 |
import { AuthService } from '../../services/auth.service';
|
15 |
|
|
|
26 |
MatProgressBarModule,
|
27 |
MatCardModule,
|
28 |
MatSnackBarModule,
|
29 |
+
MatProgressSpinnerModule
|
30 |
],
|
31 |
templateUrl: './user-info.component.html',
|
32 |
styleUrls: ['./user-info.component.scss']
|
|
|
35 |
private apiService = inject(ApiService);
|
36 |
private authService = inject(AuthService);
|
37 |
private snackBar = inject(MatSnackBar);
|
38 |
+
private router = inject(Router);
|
39 |
|
40 |
username = this.authService.getUsername() || '';
|
41 |
currentPassword = '';
|
|
|
105 |
this.currentPassword = '';
|
106 |
this.newPassword = '';
|
107 |
this.confirmPassword = '';
|
108 |
+
|
109 |
// Navigate to projects tab after successful password change
|
110 |
setTimeout(() => {
|
111 |
this.router.navigate(['/projects']);
|
112 |
}, 500);
|
113 |
+
|
114 |
} catch (error: any) {
|
115 |
const message = error.error?.detail || 'Failed to change password';
|
116 |
this.snackBar.open(message, 'Close', { duration: 5000 });
|