Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error Handler #1433

Merged
merged 2 commits into from
Jul 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/app/shared/constants/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: 'м.Київ',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,7 @@ export class UserWorkshopService {
*/

deleteWorkshop(id: string): Observable<object> {
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 {
Expand Down
4 changes: 2 additions & 2 deletions src/app/shared/store/user.state.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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' }));
Expand Down