mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-14 13:33:03 +00:00
refactored resource type and type mapping
This commit is contained in:
@@ -20,7 +20,7 @@ import { DSpaceRESTv2Serializer } from '../dspace-rest-v2/dspace-rest-v2.seriali
|
||||
import { catchError, filter, flatMap, map, take, tap } from 'rxjs/operators';
|
||||
import { ErrorResponse, RestResponse } from '../cache/response.models';
|
||||
import { StoreActionTypes } from '../../store.actions';
|
||||
import { getNormalizedConstructorByType } from '../shared/resource-type.decorator';
|
||||
import { getMapsToType } from '../cache/builders/build-decorators';
|
||||
|
||||
export const addToResponseCacheAndCompleteAction = (request: RestRequest, envConfig: GlobalConfig) =>
|
||||
(source: Observable<RestResponse>): Observable<RequestCompleteAction> =>
|
||||
@@ -45,7 +45,7 @@ export class RequestEffects {
|
||||
flatMap((request: RestRequest) => {
|
||||
let body;
|
||||
if (isNotEmpty(request.body)) {
|
||||
const serializer = new DSpaceRESTv2Serializer(getNormalizedConstructorByType(request.body.type));
|
||||
const serializer = new DSpaceRESTv2Serializer(getMapsToType(request.body.type));
|
||||
body = serializer.serialize(request.body);
|
||||
}
|
||||
return this.restApi.request(request.method, request.href, body, request.options).pipe(
|
||||
|
Reference in New Issue
Block a user