feat: add current password field to change password form and update service payload structure
This commit is contained in:
@@ -1 +1,5 @@
|
||||
<shared-change-password-form-dialog [(visible)]="visible" [loading]="submitLoading()" (onSubmit)="submit($event)" />
|
||||
<shared-change-password-form-dialog
|
||||
[(visible)]="visible"
|
||||
[showCurrentPasswordField]="true"
|
||||
[loading]="submitLoading()"
|
||||
(onSubmit)="submit($event)" />
|
||||
|
||||
@@ -23,7 +23,7 @@ export class PosChangePasswordComponent extends AbstractDialog {
|
||||
this.submitLoading.set(true);
|
||||
|
||||
this.service
|
||||
.changePassword(payload.password)
|
||||
.changePassword(payload)
|
||||
.pipe(finalize(() => this.submitLoading.set(false)))
|
||||
.subscribe(() => {
|
||||
this.toastService.success({
|
||||
|
||||
@@ -2,13 +2,18 @@ import { HttpClient } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
interface IChangePasswordSubmitPayload {
|
||||
currentPassword: string;
|
||||
password: string;
|
||||
}
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class PosChangePasswordService {
|
||||
constructor(private readonly http: HttpClient) {}
|
||||
|
||||
changePassword(password: string): Observable<unknown> {
|
||||
return this.http.put('/api/v1/pos/update-password', { password });
|
||||
changePassword(payload: IChangePasswordSubmitPayload): Observable<unknown> {
|
||||
return this.http.put('/api/v1/pos/update-password', payload);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user