mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-13 13:03:04 +00:00
54472: Small changes
This commit is contained in:
@@ -10,7 +10,7 @@ import { Router } from '@angular/router';
|
|||||||
import { DSOSuccessResponse, ErrorResponse } from '../../core/cache/response-cache.models';
|
import { DSOSuccessResponse, ErrorResponse } from '../../core/cache/response-cache.models';
|
||||||
import { Observable } from 'rxjs/Observable';
|
import { Observable } from 'rxjs/Observable';
|
||||||
import { ResponseCacheEntry } from '../../core/cache/response-cache.reducer';
|
import { ResponseCacheEntry } from '../../core/cache/response-cache.reducer';
|
||||||
import { map, take } from 'rxjs/operators';
|
import { first, map, take } from 'rxjs/operators';
|
||||||
import { RemoteData } from '../../core/data/remote-data';
|
import { RemoteData } from '../../core/data/remote-data';
|
||||||
import { isNotEmpty } from '../../shared/empty.util';
|
import { isNotEmpty } from '../../shared/empty.util';
|
||||||
import { DSpaceObject } from '../../core/shared/dspace-object.model';
|
import { DSpaceObject } from '../../core/shared/dspace-object.model';
|
||||||
@@ -26,7 +26,12 @@ export class CreateCollectionPageComponent {
|
|||||||
public parentUUID$: Observable<string>;
|
public parentUUID$: Observable<string>;
|
||||||
public communityRDObs: Observable<RemoteData<Community>>;
|
public communityRDObs: Observable<RemoteData<Community>>;
|
||||||
|
|
||||||
public constructor(private collectionDataService: CollectionDataService, private communityDataService: CommunityDataService, private routeService: RouteService, private router: Router) {
|
public constructor(
|
||||||
|
private collectionDataService: CollectionDataService,
|
||||||
|
private communityDataService: CommunityDataService,
|
||||||
|
private routeService: RouteService,
|
||||||
|
private router: Router
|
||||||
|
) {
|
||||||
this.parentUUID$ = this.routeService.getQueryParameterValue('parent');
|
this.parentUUID$ = this.routeService.getQueryParameterValue('parent');
|
||||||
this.parentUUID$.subscribe((uuid: string) => {
|
this.parentUUID$.subscribe((uuid: string) => {
|
||||||
if (isNotEmpty(uuid)) {
|
if (isNotEmpty(uuid)) {
|
||||||
@@ -47,10 +52,9 @@ export class CreateCollectionPageComponent {
|
|||||||
// TODO: metadata for news and provenance
|
// TODO: metadata for news and provenance
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
this.collectionDataService.create(collection, uuid).pipe(take(1)).subscribe((rd: RemoteData<DSpaceObject>) => {
|
this.collectionDataService.create(collection, uuid).subscribe((rd: RemoteData<DSpaceObject>) => {
|
||||||
if (rd.hasSucceeded) {
|
const url: string = '/collections/' + rd.payload.id;
|
||||||
this.router.navigateByUrl('');
|
this.router.navigateByUrl(url);
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -61,7 +61,7 @@ export class DSpaceRESTv2Service {
|
|||||||
request(method: RestRequestMethod, url: string, body?: any, options?: HttpOptions): Observable<DSpaceRESTV2Response> {
|
request(method: RestRequestMethod, url: string, body?: any, options?: HttpOptions): Observable<DSpaceRESTV2Response> {
|
||||||
const requestOptions: HttpOptions = {};
|
const requestOptions: HttpOptions = {};
|
||||||
requestOptions.body = body;
|
requestOptions.body = body;
|
||||||
if (method === RestRequestMethod.Post && isNotEmpty(body)) {
|
if (method === RestRequestMethod.Post && isNotEmpty(body.name)) {
|
||||||
requestOptions.body = this.buildFormData(body);
|
requestOptions.body = this.buildFormData(body);
|
||||||
}
|
}
|
||||||
requestOptions.observe = 'response';
|
requestOptions.observe = 'response';
|
||||||
|
Reference in New Issue
Block a user