Merged PR 2033: Add, Lock, Unlock Customer Cards

Add, Lock, Unlock Customer Cards

Refs: #5313, #5329, #5334, #5335
This commit is contained in:
Nino Righi
2025-11-20 13:59:26 +00:00
committed by Lorenz Hilpert
parent b7d008e339
commit 17cb0802c3
25 changed files with 908 additions and 191 deletions

View File

@@ -1,8 +1,9 @@
import { catchError } from 'rxjs/operators';
import { OperatorFunction, throwError } from 'rxjs';
import { catchError, mergeMap } from 'rxjs/operators';
import { OperatorFunction, throwError, pipe } from 'rxjs';
import { ResponseArgsError } from '../errors';
import { HttpErrorResponse } from '@angular/common/http';
import { ResponseArgs } from '../models';
import { isResponseArgs } from '../helpers';
/**
*
@@ -19,25 +20,34 @@ import { ResponseArgs } from '../models';
*
*/
export const catchResponseArgsErrorPipe = <T>(): OperatorFunction<T, T> =>
catchError((err: unknown) => {
if (err instanceof ResponseArgsError) {
return throwError(() => err);
}
if (err instanceof HttpErrorResponse && err.error) {
const payload = err.error as Partial<ResponseArgs<unknown>>;
if (payload.error === true) {
return throwError(
() =>
new ResponseArgsError({
error: true,
message: payload.message,
invalidProperties: payload.invalidProperties ?? {},
}),
);
pipe(
catchError((err: unknown) => {
if (err instanceof ResponseArgsError) {
return throwError(() => err);
}
}
return throwError(() => err);
});
if (err instanceof HttpErrorResponse && err.error) {
const payload = err.error as Partial<ResponseArgs<unknown>>;
if (payload.error === true) {
return throwError(
() =>
new ResponseArgsError({
error: true,
message: payload.message,
invalidProperties: payload.invalidProperties ?? {},
}),
);
}
}
return throwError(() => err);
}),
mergeMap((response) => {
if (isResponseArgs(response) && response.error === true) {
return throwError(() => new ResponseArgsError(response));
}
return [response];
}),
);