Skip to content
Snippets Groups Projects
Commit ac4db73f authored by Albert Bruns's avatar Albert Bruns
Browse files

OZG-3563 after merge fix

parent 0a55c467
No related branches found
No related tags found
1 merge request!129OZG-3563-anbindung-resourceservice-kommentar-shared
import { ConfigurationLinkRel, ConfigurationResource, ConfigurationService } from '@admin-client/configuration-shared'; import { ConfigurationLinkRel, ConfigurationResource, ConfigurationService } from '@admin-client/configuration-shared';
import { import { ApiListResourceService, ListResourceServiceConfig, ResourceRepository } from '@alfa-client/tech-shared';
ApiListResourceService,
ListResourceServiceConfig,
ResourceListService,
ResourceRepository,
} from '@alfa-client/tech-shared';
import { AggregationMappingListLinkRel } from './aggregation-mapping.linkrel'; import { AggregationMappingListLinkRel } from './aggregation-mapping.linkrel';
import { AggregationMappingListResource, AggregationMappingResource } from './aggregation-mapping.model'; import { AggregationMappingListResource, AggregationMappingResource } from './aggregation-mapping.model';
export class AggregationMappingListResourceService extends ResourceListService< export class AggregationMappingListResourceService extends ApiListResourceService<
ConfigurationResource, ConfigurationResource,
AggregationMappingListResource, AggregationMappingListResource,
AggregationMappingResource AggregationMappingResource
......
...@@ -41,7 +41,7 @@ export class ApiResourceService<B extends Resource, T extends Resource> extends ...@@ -41,7 +41,7 @@ export class ApiResourceService<B extends Resource, T extends Resource> extends
super(config, stateService); super(config, stateService);
} }
public save(toSave: unknown): Observable<StateResource<T | HttpError>> { public save(toSave: unknown): Observable<StateResource<T>> {
return this.selectResource().pipe( return this.selectResource().pipe(
switchMap((stateResource: StateResource<T>) => switchMap((stateResource: StateResource<T>) =>
this.doSave(stateResource.resource, toSave).pipe( this.doSave(stateResource.resource, toSave).pipe(
...@@ -50,7 +50,7 @@ export class ApiResourceService<B extends Resource, T extends Resource> extends ...@@ -50,7 +50,7 @@ export class ApiResourceService<B extends Resource, T extends Resource> extends
catchError((errorResponse: HttpErrorResponse) => this.handleError(errorResponse)), catchError((errorResponse: HttpErrorResponse) => this.handleError(errorResponse)),
), ),
), ),
startWith(createEmptyStateResource<T | HttpError>(true)), startWith(createEmptyStateResource<T>(true)),
); );
} }
...@@ -62,7 +62,7 @@ export class ApiResourceService<B extends Resource, T extends Resource> extends ...@@ -62,7 +62,7 @@ export class ApiResourceService<B extends Resource, T extends Resource> extends
}); });
} }
public patch(toPatch: unknown): Observable<StateResource<T | HttpError>> { public patch(toPatch: unknown): Observable<StateResource<T>> {
return this.selectResource().pipe( return this.selectResource().pipe(
switchMap((stateResource: StateResource<T>) => switchMap((stateResource: StateResource<T>) =>
this.doPatch(stateResource.resource, toPatch).pipe( this.doPatch(stateResource.resource, toPatch).pipe(
...@@ -71,7 +71,7 @@ export class ApiResourceService<B extends Resource, T extends Resource> extends ...@@ -71,7 +71,7 @@ export class ApiResourceService<B extends Resource, T extends Resource> extends
catchError((errorResponse: HttpErrorResponse) => this.handleError(errorResponse)), catchError((errorResponse: HttpErrorResponse) => this.handleError(errorResponse)),
), ),
), ),
startWith(createEmptyStateResource<T | HttpError>(true)), startWith(createEmptyStateResource<T>(true)),
); );
} }
...@@ -83,7 +83,7 @@ export class ApiResourceService<B extends Resource, T extends Resource> extends ...@@ -83,7 +83,7 @@ export class ApiResourceService<B extends Resource, T extends Resource> extends
}); });
} }
handleError(errorResponse: HttpErrorResponse): Observable<StateResource<HttpError>> { handleError(errorResponse: HttpErrorResponse): Observable<StateResource<T>> {
if (isUnprocessableEntity(errorResponse.status)) { if (isUnprocessableEntity(errorResponse.status)) {
return of(createErrorStateResource((<any>errorResponse) as HttpError)); return of(createErrorStateResource((<any>errorResponse) as HttpError));
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment