From 1ce9d3ef7255fee0457dbd1404fc17ec63c465f6 Mon Sep 17 00:00:00 2001 From: Jernej Pregelj Date: Tue, 26 Mar 2019 17:42:24 +0100 Subject: [PATCH] category error fix --- client/src/routes/Publish/Step.tsx | 9 ++------- client/src/routes/Publish/index.tsx | 8 ++++---- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/client/src/routes/Publish/Step.tsx b/client/src/routes/Publish/Step.tsx index 8ab1014..4dc841e 100644 --- a/client/src/routes/Publish/Step.tsx +++ b/client/src/routes/Publish/Step.tsx @@ -89,11 +89,6 @@ export default class Step extends PureComponent { {fields && Object.entries(fields).map(([key, value]) => { - let onChange = inputChange - - if (key === 'categories') { - onChange = inputToArrayChange - } if (key === 'files') { return ( @@ -106,7 +101,7 @@ export default class Step extends PureComponent { name={key} help={value.help} files={state.files} - onChange={onChange} + onChange={inputChange} /> ) @@ -122,7 +117,7 @@ export default class Step extends PureComponent { type={value.type} help={value.help} options={value.options} - onChange={onChange} + onChange={inputChange} rows={value.rows} value={(state as any)[key]} /> diff --git a/client/src/routes/Publish/index.tsx b/client/src/routes/Publish/index.tsx index fe79d67..5c558de 100644 --- a/client/src/routes/Publish/index.tsx +++ b/client/src/routes/Publish/index.tsx @@ -21,7 +21,7 @@ interface PublishState { type?: AssetType license?: string copyrightHolder?: string - categories?: string[] + categories?: string tags?: string[] isPublishing?: boolean isPublished?: boolean @@ -43,7 +43,7 @@ class Publish extends Component<{}, PublishState> { type: 'dataset' as AssetType, license: '', copyrightHolder: '', - categories: [], + categories: '', isPublishing: false, isPublished: false, publishedDid: '', @@ -110,7 +110,7 @@ class Publish extends Component<{}, PublishState> { type: 'dataset' as AssetType, license: '', copyrightHolder: '', - categories: [], + categories: '', isPublishing: false, isPublished: false, currentStep: 1 @@ -257,7 +257,7 @@ class Publish extends Component<{}, PublishState> { files: this.state.files, price: this.state.price, type: this.state.type, - categories: this.state.categories, + categories: [this.state.categories], size: '', encoding: '', compression: undefined,