Вキ
Size: a a a
𝕮[
SC
🏡B
𝕮[
zone-evergreen.js:171 Uncaught TypeError: dir.valueAccessor.registerOnTouched is not a function
𝕮[
🏡B
🏡B
EK
zone-evergreen.js:171 Uncaught TypeError: dir.valueAccessor.registerOnTouched is not a function
CD
TypeError: notify_1.Notify is not a function
at /usr/src/app/dist/nvi/server/main.js:431276:18
at Object../src/app/shared/services/contragent.service.ts (/usr/src/app/dist/nvi/server/main.js:431287:2)
CD
import {Observable, throwError} from 'rxjs';
import {catchError, tap} from 'rxjs/operators';
import {AlertNotifyService} from '@app/modules/system-notify/services/alert-notify.service';
import {AppBrowserModule} from '@app/app.browser.module';
import {IAlertNotify} from '@app/modules/system-notify/interface/alert-notify.interface';
/**
* Notify decorator. Декоратор системных сообщений
*/
export function Notify(notify: INotifyDecorator): MethodDecorator {
return function (_target: Observable<any>, _key: string, descriptor: any) {
const originalMethod = descriptor.value;
descriptor.value = function (...args: any[]) {
const alertNotifyService = AppBrowserModule.injector.get(AlertNotifyService);
const observable$ = originalMethod.apply(this, args);
return observable$.pipe(
catchError(error => {
let errorText = notify.error?.text || '';
if (!errorText) {
const errors = error.error?.errors || error.errors || error.error;
if (Array.isArray(errors)) {
errors.forEach((errorMesage: string) => (errorText += `${errorMesage} <br>`));
} else if (typeof errors === 'string') {
errorText = errors;
}
}
alertNotifyService.addSystemNotify({...notify.error, text: errorText, type: 'error'});
return throwError(error);
}),
tap(() => {
if (notify.success) {
alertNotifyService.addSystemNotify({...notify.success, type: 'success'});
}
}),
);
};
return descriptor;
};
}
𝕮[
𝕮[
S
S
S
S
S
𝕮[