Added user edit logic
This commit is contained in:
@ -29,7 +29,7 @@
|
||||
Confirm new password
|
||||
</label>
|
||||
<input class="input w-full shadow text-center" id="password3" type="password" placeholder="********" name="newPasswordConfirm"
|
||||
[(ngModel)]="confirmPassword">
|
||||
[(ngModel)]="confirmNewPassword">
|
||||
</div>
|
||||
|
||||
<div class="modal-action">
|
||||
|
@ -19,13 +19,13 @@ export class EdituserComponent {
|
||||
username: string = "";
|
||||
originalPassword: string = "";
|
||||
newPassword: string = "";
|
||||
confirmPassword: string = "";
|
||||
confirmNewPassword: string = "";
|
||||
|
||||
constructor(private developmentStore: DevelopmentStore, private authStore: AuthStore) {}
|
||||
|
||||
async saveUser() {
|
||||
|
||||
if(this.newPassword !== this.confirmPassword) {
|
||||
if(this.newPassword !== this.confirmNewPassword) {
|
||||
alert("New password and confirm password do not match");
|
||||
return;
|
||||
}
|
||||
@ -33,16 +33,17 @@ export class EdituserComponent {
|
||||
try {
|
||||
const response = await axios({
|
||||
method: 'post',
|
||||
url: this.developmentStore.getBaseUrl() + 'api/v1/secure/user/update',
|
||||
url: this.developmentStore.getBaseUrl() + 'api/v1/secure/users',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': 'Bearer ' + await firstValueFrom(this.authStore.token$)
|
||||
},
|
||||
data: {
|
||||
originalUsername: this.parsedUsername,
|
||||
username: this.username,
|
||||
originalPassword: this.originalPassword,
|
||||
newPassword: this.newPassword,
|
||||
confirmPassword: this.confirmPassword
|
||||
newPasswordConfirm: this.confirmNewPassword
|
||||
}
|
||||
});
|
||||
// TODO: Implement backend logic for this
|
||||
|
Reference in New Issue
Block a user