Added redirect after user credentials change

This commit is contained in:
2024-06-01 13:41:26 +02:00
parent 77202de315
commit 4977dbe98a
3 changed files with 14 additions and 5 deletions

View File

@ -4,6 +4,7 @@ import axios from "axios";
import {firstValueFrom} from "rxjs";
import {DevelopmentStore} from "../../../store/DevelopmentStore";
import {AuthStore} from "../../../store/authStore";
import {Router} from "@angular/router";
@Component({
selector: 'app-edituser',
@ -21,7 +22,7 @@ export class EdituserComponent {
newPassword: string = "";
confirmNewPassword: string = "";
constructor(private developmentStore: DevelopmentStore, private authStore: AuthStore) {}
constructor(private developmentStore: DevelopmentStore, private authStore: AuthStore, private router: Router) {}
async saveUser() {
@ -46,8 +47,9 @@ export class EdituserComponent {
newPasswordConfirm: this.confirmNewPassword
}
});
// TODO: Implement backend logic for this
console.log("User updated successfully");
alert("User updated successfully. Please log in again to continue.");
await this.router.navigate(['/login']);
} catch (error) {
console.error(error);
}