54472: Send normalized collections/communities instead of FormData

This commit is contained in:
Kristof De Langhe
2018-11-06 09:57:27 +01:00
parent 1fc9359133
commit dd439109a4
3 changed files with 16 additions and 6 deletions

View File

@@ -9,6 +9,8 @@ import { Observable } from 'rxjs';
import { take } from 'rxjs/operators';
import { RemoteData } from '../../core/data/remote-data';
import { isNotEmpty } from '../../shared/empty.util';
import { NormalizedCollection } from '../../core/cache/models/normalized-collection.model';
import { ResourceType } from '../../core/shared/resource-type';
@Component({
selector: 'ds-create-collection',
@@ -36,7 +38,7 @@ export class CreateCollectionPageComponent {
onSubmit(data: any) {
this.parentUUID$.pipe(take(1)).subscribe((uuid: string) => {
const collection = Object.assign(new Collection(), {
const collection = Object.assign(new NormalizedCollection(), {
name: data.name,
metadata: [
{ key: 'dc.description', value: data.introductory },
@@ -44,7 +46,8 @@ export class CreateCollectionPageComponent {
{ key: 'dc.rights', value: data.copyright },
{ key: 'dc.rights.license', value: data.license }
// TODO: metadata for news and provenance
]
],
type: ResourceType.Collection
});
this.collectionDataService.create(collection, uuid).subscribe((rd: RemoteData<Collection>) => {
if (rd.hasSucceeded) {