From 10d7183c7f4c04842e90934dc33eaeca7dce01ab Mon Sep 17 00:00:00 2001 From: Oleksandra Lytvynets Date: Thu, 7 Jul 2022 13:18:28 +0300 Subject: [PATCH 1/2] err handler err handler --- src/app/shared/constants/constants.ts | 3 +++ src/app/shared/store/user.state.ts | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/app/shared/constants/constants.ts b/src/app/shared/constants/constants.ts index b9aa961e7d..380433d4c6 100644 --- a/src/app/shared/constants/constants.ts +++ b/src/app/shared/constants/constants.ts @@ -27,6 +27,9 @@ export class Constants { static readonly SOCIAL_GROUP_ID_ABSENT_VALUE = 0; static readonly INSTITUTION_STATUS_ID_ABSENT_VALUE = 0; + static readonly UNABLE_CREATE_PROVIDER = 'Unable to create a new provider'; + static readonly THERE_IS_SUCH_DATA = ': There is already a provider with such a data'; + static readonly NO_CITY = 'Такого міста немає'; static readonly KIEV: City = { district: 'м.Київ', diff --git a/src/app/shared/store/user.state.ts b/src/app/shared/store/user.state.ts index b2b1dc019c..c676f8b5e8 100644 --- a/src/app/shared/store/user.state.ts +++ b/src/app/shared/store/user.state.ts @@ -1,3 +1,4 @@ +import { Constants } from 'src/app/shared/constants/constants'; import { WorkshopCard, WorkshopFilterCard } from 'src/app/shared/models/workshop.model'; import { Favorite, WorkshopFavoriteCard } from './../models/favorite.model'; import { FavoriteWorkshopsService } from './../services/workshops/favorite-workshops/favorite-workshops.service'; @@ -477,8 +478,7 @@ export class UserState { ): void { throwError(payload); const message = - payload.error === - 'Unable to create a new provider: There is already a provider with such a data' + payload.error === Constants.UNABLE_CREATE_PROVIDER || Constants.UNABLE_CREATE_PROVIDER + Constants.THERE_IS_SUCH_DATA ? 'Перевірте введені дані. Електрона пошта, номер телефону та ІПН/ЄДПРО мають бути унікальними' : 'На жаль виникла помилка'; dispatch(new ShowMessageBar({ message, type: 'error' })); From 9d483e6e6b23b3ef5f52ec0cd89335b6dd7f6f5d Mon Sep 17 00:00:00 2001 From: Oleksandra Lytvynets Date: Thu, 7 Jul 2022 13:22:24 +0300 Subject: [PATCH 2/2] Update user-workshop.service.ts --- .../services/workshops/user-workshop/user-workshop.service.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/app/shared/services/workshops/user-workshop/user-workshop.service.ts b/src/app/shared/services/workshops/user-workshop/user-workshop.service.ts index 0d492a2c35..b4807b6502 100644 --- a/src/app/shared/services/workshops/user-workshop/user-workshop.service.ts +++ b/src/app/shared/services/workshops/user-workshop/user-workshop.service.ts @@ -74,9 +74,7 @@ export class UserWorkshopService { */ deleteWorkshop(id: string): Observable { - return this.isRelease2 - ? this.http.delete(`/api/v2/Workshop/Delete/${id}`) - : this.http.delete(`/api/v1/Workshop/Delete/${id}`); + return this.http.delete(`/api/v2/Workshop/Delete/${id}`); } private createFormData(workshop: Workshop): FormData {